Re: Using Unicode file names with ftplib and encodings.idna as a workaround?
En Tue, 22 Jun 2010 11:43:34 -0300, escribió: Python 2.6.5 (Win32): Is there a work around for ftplib's (and ftputil's) apparent inability to support Unicode file names? I'm thinking that I might be able to use the encodings.idna as a work around for this? According to RFC 2640, you should use UTF-8 instead. http://www.faqs.org/rfcs/rfc2640.html One downside is that processes on the server will also have to wrap directory access with a similar transformation. This wouldn't be too complicated for Python programs, but I'm not sure how convenient this would be for our PHP and shell scripters. (Just checked: There's a PEAR module for PHP4/5; oddly enough nothing pops up for .NET IDNA libraries) The server software must be able to convert from file system encoding to utf-8 and viceversa; check its configuration. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Using Unicode file names with ftplib and encodings.idna as a workaround?
Python 2.6.5 (Win32): Is there a work around for ftplib's (and ftputil's) apparent inability to support Unicode file names? I'm thinking that I might be able to use the encodings.idna as a work around for this? In other words, regardless of whether I'm getting or putting a file to the server, I would encode the remote paths like so: remotePath = encodings.idna.ToASCII( localPath ) I would then wrap the nlst command so that the list of returned file names would have the following transformation applied to each filename: [ encodings.idna.ToUnicode( item ) for item in os.listdir('') ] One downside is that processes on the server will also have to wrap directory access with a similar transformation. This wouldn't be too complicated for Python programs, but I'm not sure how convenient this would be for our PHP and shell scripters. (Just checked: There's a PEAR module for PHP4/5; oddly enough nothing pops up for .NET IDNA libraries) Another challenge: Which Python idna encoding technique to use? I just started a thread that points out that encodings.idna.ToASCII( fileName ) != fileName.encoding( 'idna' ). Thoughts? Malcolm -- http://mail.python.org/mailman/listinfo/python-list