[Twisted-Python] Sending unicode strings

Bob Ippolito bob at redivi.com
Sat Apr 23 02:50:43 EDT 2005


On Apr 23, 2005, at 2:17 AM, Tommi Virtanen wrote:

> 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
>
> ... to convert Unicode strings to UTF-8 on the client side ...
>
>> and then once again from ISO to UTF8 on the server side, so I suppose
>
> ...from UTF-8 to Unicode on the server side...
>
> Personally, I think ass-u-ming Unicode is encoded as UTF-8 would have
> been sane, but I can understand that not everyone agrees; e.g. Java
> wants UCS-16 if I remember correctly. And not serializing to UTF-8
> by default catches errors that would otherwise cause mysterious things
> to happen.

The most mysterious of things is that with such ass-umptions you put 
unicode in and you get str out.  This is especially bad because your 
default encoding is not utf-8.  So, your program explodes, people die, 
and you have to clean up the mess later.

-bob





More information about the Twisted-Python mailing list