8 ms·
> "But for real if anyone knows how to get this to work on Windows 10 let me know!" Since the May 2019 update, Windows 10 has supported declaring the code page
by Dwedit 4y ago
> "But for real if anyone knows how to get this to work on Windows 10 let me know!"
Since the May 2019 update, Windows 10 has supported declaring the code page in a manifest file.
In Visual Studio, you must add "/utf-8" to the compiler command line, this makes it parse the source code as a UTF-8 file, and makes it output UTF-8 string literals.
To make console output work, call the Win32 function "SetConsoleOutputCP(65001);"
To get support for opening files with names that aren't in your system codepage:
* Create a manifest file as shown in https://learn.microsoft.com/en-us/windows/apps/design https://learn.microsoft.com/en-us/windows/apps/design
/globalizing/use-utf8-code-page
* Add this as an "Additional Manifest File" in Visual Studio project settings for the manifest tool
Additionally, there is an undocumented NTDLL function "RtlInitNlsTables" that sets the code page for the process. It is difficult to use without a lot of example code, but some app locale type tools (used to change locale for a process) make use of this function.