[Python-Dev] Windows: Remove support of bytes filenames in theos module?

Andrew Barnert abarnert at yahoo.com
Tue Feb 9 21:01:21 EST 2016


On Feb 9, 2016, at 17:37, Steve Dower <python at stevedower.id.au> wrote:
> 
> Could we perhaps redefine bytes paths on Windows as utf8 and use Unicode everywhere internally?

When you receive bytes from argv, stdin, a text file, a GUI, a named pipe, etc., and then use them as a path, Python treating them as UTF-8 would break everything.

Plus, the problem only exists in Python 2, and Python is not going to fix Unicode support in Python 2, both because it's too late for such a major change in Python 2, and because it's probably impossible* (which is why we have Python 3 in the first place). 

> I really don't like the idea of not being able to use bytes in cross platform code. Unless it's become feasible to use Unicode for lossless filenames on Linux - last I heard it wasn't.

It is, and has been for years. Surrogate escaping solved the linux problem. That doesn't help for Python 2, but again, it's too late for Python 2.


* Well, maybe in the future, some linux distros will bite the same bullet OS X did and mandate that filesystem drivers must expose UTF-8, doing whatever transcoding or other munging is necessary under the covers, to be valid. But I'm guessing any such distros will be all-Python-3 long before then, and the people using Python 2 will also be using old versions or conservative distros.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160209/369f6e9c/attachment.html>


More information about the Python-Dev mailing list