[Python-3000] Unicode strings, identifiers, and import

Giovanni Bajo rasky at develer.com
Fri May 18 01:31:03 CEST 2007


On 18/05/2007 1.24, James Y Knight wrote:

> unicode_filename.encode(sys.getfilesystemencoding() or 'ascii',  
> 'xmlcharrefreplace') would work.

Thanks - using "xmlcharrefreplace" hadn't occurred to me!

> The *really* tricky thing is that on unix systems, if you want to be  
> able to access all the files on the disk, you have to use the byte- 
> string API, as not all filenames are convertible to unicode. But on  
> windows, if you want to be able to access all the files on the disk,  
> you *CANNOT* use the byte-string api, because not all filenames  
> (which are unicode on disk) are convertible to bytestrings via the  
> "mbcs" encoding (which is what getfilesystemencoding() reports). It's  
> quite a pain in the ass really.

Yes. I hope that Py3k will solve this somehow.
-- 
Giovanni Bajo



More information about the Python-3000 mailing list