[Python-ideas] Fix default encodings on Windows

eryk sun eryksun at gmail.com
Wed Aug 10 19:49:21 EDT 2016


On Wed, Aug 10, 2016 at 11:30 PM, Random832 <random832 at fastmail.com> wrote:
> Er... utf-8 doesn't work reliably with arbitrary bytes paths either,
> unless you intend to use surrogateescape (which you could also do with
> mbcs).
>
> Is there any particular reason to expect all bytes paths in this
> scenario to be valid UTF-8?

The problem is more so that data is lost without an error when using
the legacy ANSI API. If the path is invalid UTF-8, Python will at
least raise an exception when decoding it. To work around this, the
developers may decide they need to just bite the bullet and use
Unicode, or maybe there could be legacy Latin-1 and ANSI modes enabled
by an environment variable or sys flag.


More information about the Python-ideas mailing list