STINNER Victor <victor.stin...@haypocalc.com> added the comment:

utf-8 codec (in strict mode) rejects surrogates in python3, and so you doesn't 
support undecodable filenames (filenames decoded using surrogateescape error 
handler which produces surrogate characters). It may be possible if you use 
surrogateescape everywhere.

Manipulate encoded filenames is not trivial because it may quickly lead to 
mojibake if the encodings are different (eg. if sys.path contains a bytes 
filename, you have to be careful). Use utf-8 means that you have to decode and 
then reencode (to the filesystem encoding) a filename before passing it to a 
system call (eg. mkdir()). #8611 problem is that Python3 doesn't work if the 
filesystem is *not* utf-8.

You solution is attractive because it is short, but I prefer to use directly 
the right solution to not patch Python twice: use unicode (with surrogates, PEP 
383, for undecodable filenames) everywhere.

----------

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

Reply via email to