[Twisted-Python] Unicode

Ken Kinder ken at kenkinder.com
Tue Oct 4 10:24:52 MDT 2005


Andrew Bennetts wrote:

>The issue is that the python-global default implicit encoding of unicode to
>str could be completely wrong for any given protocol and transport instance
>(i.e. socket).  Protocol implementations should not be vulnerable to bugs
>just because someone adds sys.setdefaultencoding('utf-16') to their
>sitecustomize.py.
>
>It's not hard at all to imagine a situation where two different sockets have
>two completely different encodings -- e.g. HTTP servers can and should
>choose charsets for responses based on what the client request asks for,
>iirc.
>
>This is formally addressed in the Twisted documentation -- as a FAQ -- here:
>
>    http://twistedmatrix.com/projects/core/documentation/howto/faq.html#auto25
>  
>
Fair enough, although perhaps that link should be part of the comment
that reads something to the effect of "no unicode, I mean it."





More information about the Twisted-Python mailing list