Eryk Sun <eryk...@gmail.com> added the comment:

> It would be nice to get an unit test for this case.

The process code page from GetACP() is either an ANSI code page or CP_UTF8 
(65001). It should never be a Western OEM code page such as 850. In that case, 
a reliable unit test would check that the configured encoding is a particular 
OEM code page. For example, spawn a new interpreter in a windowless console 
session (i.e. creationflags=CREATE_NO_WINDOW). Set the session's input code 
page to 850 via ctypes.WinDLL('kernel32').SetConsoleCP(850). Set 
os.environ['PYTHONLEGACYWINDOWSSTDIO'] = '1'. Then spawn [sys.executable, '-c', 
'import sys; print(sys.stdin.encoding)'], and verify that the output is 'cp850'.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42261>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to