unicode and socket

Fredrik Lundh fredrik at pythonware.com
Sat Feb 19 12:39:04 EST 2005


anonymous coward <zyqnews at 163.net> wrote:

> It's really funny, I cannot send a unicode stream throuth socket with
> python while all the other languages as perl,c and java can do it.

Are you sure you understand what Unicode is, and how sockets work?

Sockets are used to transfer byte streams.  If you want to transfer
a python-level object, you have to decide how to encode it as a
byte stream.  For integers, you have to decide whether to use a single
byte, a string of decimal ascii characters, netstring syntax, etc.  For
text, you have to decide what character encoding to use.  For arbitrary
objects, you have to decide what serialisation protocol to use.  etc.

(and yes, the same applies to all other languages.  Java sockets and C
sockets are no different from Python sockets...)

</F> 






More information about the Python-list mailing list