The Unicode characters that can be printed on a cmd.exe console on Windows through clisp is limited by the *TERMINAL-ENCODING*
.
1) The *TERMINAL-ENCODING*
is determined from GetOEMCP(). This does not consider the possibility of "chcp 65001". So, need to use GetConsoleOutputCP() instead of GetOEMCP().
2) There are 3 ways to output arbitrary Unicode characters (or at least Unicode BMP characters) to a console.
References:
http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using
https://msdn.microsoft.com/en-us/library/tw4k6df8.aspx
2.1) Instead of WriteFile and WriteConsole with a char*
argument, use WriteConsoleW with a wchar_t*
argument.
2.2) Use _setmode(1, _O_U16TEXT). Pass a char*
argument with text in aligned UTF-16LE encoding.
2.3) Use _setmode(1, _O_U8TEXT). Pass a char*
argument with text in UTF-8 encoding.
Another reference:
http://stackoverflow.com/questions/3130979/how-to-output-unicode-strings-on-the-windows-console