[Twisted-Python] Twisted FTP: Data must not be unicode
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Thu Nov 24 08:00:35 MST 2011
On 02:26 pm, tobias.oberstein at tavendo.de wrote:
>>An even more correct solution would be for `line` to have been encoded
>>properly already before it was passed to `sendLine`. Where did the
>>data
>>come from, and why wasn't it encoded already?
>
>The data is coming from the FTP directory listing formatting function
>
>ftp.DTP. _formatOneListResponse
>
>Here is a more localized fix:
>
>[autobahn at autobahnhub ~/Twisted]$ svn diff twisted/protocols/ftp.py
>Index: twisted/protocols/ftp.py
>===================================================================
>--- twisted/protocols/ftp.py (revision 33225)
>+++ twisted/protocols/ftp.py (working copy)
>@@ -415,7 +415,7 @@
> 'group': group[:8],
> 'size': size,
> 'date': formatDate(time.gmtime(modified)),
>- 'name': name}
>+ 'name': name.encode("utf-8")}
>
> def sendListResponse(self, name, response):
> self.sendLine(self._formatOneListResponse(name, *response))
Cool, that seems much more reasonable. It would be great if you could
file a ticket for this. Thanks!
Jean-Paul
More information about the Twisted-Python
mailing list