[Twisted-Python] Sending unicode strings

Mary Gardiner mary-twisted at puzzling.org
Sat Apr 23 01:58:13 EDT 2005


On Sat, Apr 23, 2005, Michal Chruszcz wrote:
> Why do you mean it? Why I can't send unicode through twisted? It's 
> ridiculous that I have to convert UTF8 strings to ISO on the client side 
> and then once again from ISO to UTF8 on the server side, so I suppose 
> you've got really good excuse.

In so far as you'd call "design decisions" "excuses".

Why is it ridiculous that you need to do this? It's not always going to
be Twisted on the other end after all (at least, Twisted can't assume
that at the level we're talking about), and there's umpteen million
encodings that can be used for Unicode, so encoding all Unicode objects
into bytes using the UTF8 encoding seems to be making a hell of an
assumption. Your protocol is the right place to make that
decision/assumption/assertation, write(...) is not.

http://twistedmatrix.com/projects/core/documentation/howto/faq.html#auto25

-Mary




More information about the Twisted-Python mailing list