Eryk Sun added the comment: How about this?
The character encoding is platform-dependent. Non-Windows platforms use the locale encoding (see locale.getpreferredencoding()). On Windows, UTF-8 is used for console character devices (i.e. CON, CONIN$, and CONOUT$). However, this can be overridden to use the console as a generic character device by setting the environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. Non- character devices such as disk files and pipes use the system locale encoding (i.e. the ANSI codepage). Character devices such as NUL (i.e. isatty() returns True) use the value of the console input and output codepages at startup, respectively for stdin and stdout/stderr. This defaults to the system locale encoding if the process is not initially attached to a console. Under all platforms, you can override this value by setting the PYTHONIOENCODING environment variable before starting Python. However, for the Windows console, this only applies when PYTHONLEGACYWINDOWSSTDIO is also set. ---------- nosy: +eryksun _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30410> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com