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

> When there is no console, stdio should use the default textio 
> encoding that is ANSI for now.

stdin, stdout, and stderr are special and can be special cased because they're 
used implicitly for IPC. They've always been acknowledged as special by the 
existence of PYTHONIOENCODING. I think if Python is going to change its policy 
for standard I/O, along the lines of what I think you've been arguing in favor 
of for months now, it should commit to (almost) consistently using the console 
input and output code pages for the standard I/O encoding in Windows, with 
UTF-8 as the default when there is no console session, and with the exception 
that UTF-8 is used for console files. To get legacy behavior, set 
PYTHONLEGACYWINDOWSSTDIO, which will use the console code pages for console 
standard I/O and otherwise use the process active code page for standard I/O.

The default encoding for open() would still be the process active code page 
from GetACP(), and the recommendation should be for scripts to use an explicit 
`encoding`.

----------

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

Reply via email to