Terminal control/Unicode output: Difference between revisions
m
→{{header|Phix}}
(Added Seed7 example) |
|||
Line 386:
Works on both linux and windows.
<lang Phix>
constant tGSH = """▼
▲tGSH = """
HANDLE WINAPI GetStdHandle(
_In_ DWORD nStdHandle
Line 411 ⟶ 400:
STD_OUTPUT_HANDLE = -11,
CP_UTF8 = 65001,
envset = {"LANG","LC_ALL","LC_CTYPE"}
atom k32 = NULL, xGetStdHandle, hConsole, xSetConsoleOutputCP
global function unicode_console()
-- initialises the windows console for unicode, and
--
bool res = false
if platform()=WINDOWS then
Line 431 ⟶ 416:
xSetConsoleOutputCP = define_cffi_func(k32,tSCOCP)
end if
--
res = c_func(xSetConsoleOutputCP,{CP_UTF8})
else -- LINUX
for i=1 to length(envset) do
Line 444 ⟶ 428:
return res
end function</lang>
▲We can then use it like this:
<lang Phix>include builtins\unicode_console.e
|