os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

Ross Ridge rridge at csclub.uwaterloo.ca
Sun Nov 19 22:13:30 EST 2006


Martin v. Löwis wrote:
> One approach I had been considering is to always make the decoding
> succeed, by using the private-use-area of Unicode to represent bytes
> that don't decode correctly.

That would conflict with private use characters appearing in file
names.

Personally, I think os.listdir() should return the file names only in
Unicode if they're actually stored that way in the underlying file
system (eg. NTFS), otherwise return them as byte strings.  I doubt
anyone in this thread would like that, though.

                                      Ross Ridge




More information about the Python-list mailing list