Martin Panter added the comment: I don’t know much about the conventions for stdout etc encoding on Windows. But in general, the patch does not seem robust. Does it work if sys.stdout is a pipe or file (not a console)? I doubt it will work when sys.stdout has been replaced by e.g. StringIO, and sys.stdout.encoding is None. Maybe you could use sys.__stdout__. But then, what happens when you run Python without any stdout at all, say in a GUI like Idle?
On Linux, the patch may have no effect in common cases. But again, it will break if sys.stdout has been replaced, or is set to None. Looking at _Py_device_encoding() in Python/fileutils.c, perhaps you need a Windows-specific interface to GetConsoleCP() and GetConsoleOutputCP() that subprocess can use. ---------- nosy: +martin.panter stage: -> patch review _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27179> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com