On 1/25/21, Inada Naoki
Microsoft provides UTF-8 code page for process. It can be enabled by manifest file.
How about providing Python binaris both of "UTF-8 version" and "ANSI version"?
I experimented with this manifest setting several months ago. To try it out, simply export the manifest from "python.exe", edit it to add the "activeCodePage" setting, and then replace it in "python.exe". The process active code page for GetACP() and GetOEMCP() is changed to UTF-8 (65001). The C runtime also overrides the user locale to UTF-8 if GetACP() returns UTF-8, i.e. setlocale(LC_CTYPE, "") will return "utf8" as the encoding. The console is hosted in a separate conhost.exe or openconsole.exe process, so it still defaults to the system OEM code page for its input and output code pages. This pertains only to low-level os.read() and os.write(). High-level console I/O uses io._WindowsConsoleIO for console files, which is internally UTF-16 and outwardly UTF-8.
* Windows team needs to maintain more versions.
I suppose the installer could install both sets of binaries, and copy to "python[w][_d].exe" based on an installer option. But then the UTF-8 selection statistics wouldn't be tracked, unless the installer phones home.