Serhiy Storchaka added the comment:

Thanks, Anatoly. I see an actual bug. FindFirstFile and FindNextFile return 
broken name if file unicode name can't be represented in current codepage.

I don't know what is perfect solution for this issue.

On 2.7 we can decode listdir() argument to unicode and then encode result names 
to str with sys.getfilesystemencoding() only if it is possible. Therefore 
listdir() with str argument will return unicode for non-encodable names. This 
should not make many new problems in addition to those which 2.7 already have 
with Unicode.

But on 3.x listdir() with bytes argument can returns only bytes objects. I 
don't know what to do with non-encodable names in such case. Perhaps an 
exception should be raised. Fortunately listdir() with bytes argument is rarely 
used on 3.x.

----------
components: +Extension Modules, Unicode, Windows -Library (Lib)
nosy: +ezio.melotti, larry, loewis

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

Reply via email to