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 _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com