[Tutor] Confirm that Python 2.6 ftplib does not support Unicode file names? Alternatives?
Steven D'Aprano
steve at pearwood.info
Fri Jun 25 02:59:18 CEST 2010
On Fri, 25 Jun 2010 04:51:13 am Lie Ryan wrote:
> On 06/24/10 02:10, python at bdurham.com wrote:
> > Can someone confirm that Python 2.6 ftplib does *NOT* support
> > Unicode file names? Or must Unicode file names be specially
> > encoded in order to be used with the ftplib module?
>
> I don't know the specifics about ftplib, however I believe in most
> file systems, file names are plain byte-strings, i.e. most file
> systems do not handle encoding, they only deal with plain bytes.
That is completely backwards. Most modern file systems use Unicode, not
bytes.
Windows file systems use Unicode file names:
http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
Likewise the Macintosh HFS+ file system also uses Unicode file names:
http://developer.apple.com/mac/library/technotes/tn/tn1150.html
So do UDF, ZDF and many others:
http://en.wikipedia.org/wiki/Comparison_of_file_systems
These days, if you're a developer on a non-Linux PC who doesn't need to
worry about legacy file systems, most file systems you come across will
be Unicode and not bytes. It's mostly Linux developers who have to deal
with byte file names.
--
Steven D'Aprano
More information about the Tutor
mailing list