[Python-Dev] File system path encoding on Windows (original) (raw)

Daniel Holth dholth at gmail.com
Mon Aug 29 21:10:21 EDT 2016


A nice recent blog post about paths encoding in a media player. http://beets.io/blog/paths.html . It's not merely the porting that makes it hard.

On Mon, Aug 29, 2016, 19:32 Victor Stinner <victor.stinner at gmail.com> wrote:

2016-08-24 17:44 GMT+02:00 Steve Dower <steve.dower at python.org>: > I know Nick and Victor like the idea of a -X flag (or a direct -utf8 flag), > but I prefer more specific environment variables: > > - PYTHONWINDOWSLEGACYSTDIO (for the console changes) > - PYTHONWINDOWSLEGACYPATHENCODING (assuming getfilesystemencoding() is utf8) > - PYTHONWINDOWSLEGACYLOCALEENCODING (assuming getpreferredencoding() is > utf8)

Hum, you propose the opposite behaviour of my proposed "-X utf8" switch :-) You propose to force UTF-8 by default, but add a new flag to revert to the old behaviour. Right? About (...)LEGACYSTDIO: I don't think that we need such option. Using Unicode is the obvious choice if stdout/stderr is the Windows console no? I'm not talking about the case where stdout/stderr is redirected (into a file or a pipe). Are you aware of any case where the "legacy stdio" is better than the "new" (winunicodeconsole-like) stdio? (...)PATHENCODING and (...)LOCALEENCODING: please don't do that. I tried once in Python 3.2 on Linux, and it failed badly: https://mail.python.org/pipermail/python-dev/2010-October/104517.html I don't think that it's a good idea to add an option to use two different encodings inside the same process. It's too common to exchange data between the "path encoding world" and "locale encoding world". Hum, currently, is it possible to get two different encodings for "path encoding" and "locale encoding"? Or both encodings are the ANSI code page? I only recall that the console uses a different encoding, the OEM code page. Victor


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/dholth%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160830/f09b932d/attachment-0001.html>



More information about the Python-Dev mailing list