Re: A little help with phix - please
- Posted by petelomax Feb 23, 2018
- 1109 views
Like this (phix only)?
include builtins\cffi.e constant tSCOCP = "BOOL WINAPI SetConsoleOutputCP(_In_ UINT wCodePageID);", k32 = open_dll("kernel32.dll"), xSetConsoleOutputCP = define_cffi_func(k32,tSCOCP), CP_UTF8 = 65001 puts(1,"") -- force console to exist -- the following is equivalent to running "chcp 65001": if c_func(xSetConsoleOutputCP,{CP_UTF8})=0 then printf(1,"SetConsoleOutputCP failed\n") end if sequence s = {84,101,105,108,32,86,32,71,101,110,101,114,97,116,105,111,110,32,8211,32,68,101,115,105,103,110,32,8211,32,84,101,115,116,32,8211,32,76,97,117,110,99,104,13,10} puts(1,s) s = utf16_to_utf8(s) puts(1,s)
As in:
1) yes, that is the exact error I meant, and
2) it would be nice to make that stuff before "sequence s" happen automatically