[Twisted-Python] utf-8 support for ftp

Paul Wiseman poalman at gmail.com
Wed Nov 21 12:45:17 EST 2012

On 21 November 2012 17:35, Paul Wiseman <poalman at gmail.com> wrote:
> I know this has been asked before, I've found it in several trackers.
> http://twistedmatrix.com/trac/ticket/5411
> http://twistedmatrix.com/trac/ticket/4515
> http://twistedmatrix.com/trac/ticket/5100
> Some of these were created a while ago, some with patches. I wondered
what the current status was with regards to utf-8 in ftp? Is it currently
> I'm trying to list a folder called 'Paul's Mac Pro', this gets returned
as 'Paulâ s Mac Pro'. The client tries to list that folder, and the server
returns 'Paulâ  s Mac Pro: No such file or directory.' I think the
client is interpreting the bytes that make up the unicode char as separate
ascii characters. (maybe a problem with the client? FileZilla
> This problem may be made worse by my implementation of IFTPShell, I can
try to make an example if this isn't the expected result.
> I'm returning all names and paths back encoded in utf-8, but maybe the
problem is the client isn't expecting it because there's no FEAT command
(is the patch in 4515 ok to add?)
> I just want to get an idea of how I can best go about getting this to
work. Will I need to build in support, or is it available in a newer
version, or by applying some patches?
> Thanks very much!!
> Paul

>>> a= "Paulâ  s Mac Pro"  #This is what the client gets
>>> a
'Paul\xc3\xa2\xc2\x80\xc2\x99s Mac Pro'
>>> a.decode("utf-8")
u'Paul\xe2\x80\x99s Mac Pro' #utf-8 encoding in a unicode string???
>>> b= u"Paul's Mac Pro"
>>> b.encode("utf-8")
'Paul\xe2\x80\x99s Mac Pro'

So I'm not sure exactly what's happening here, but it's like path has been
encoded twice. Bit confused as to how this could be happening!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20121121/fd1f84ab/attachment.htm 

More information about the Twisted-Python mailing list