You probably want to use UTF-16 or UTF-8 on both sides of the socket.

See http://www.python.org/moin/Unicode for more information.

So, we have a Unicode string...
>>> mystring=u'eggs and ham'
>>> mystring
u'eggs and ham'

Now, we want to send it over:
>>> to_send=mystring.encode('utf-8')
>>> to_send
'eggs and ham'

It's encoded in UTF-8 now.

On the other side, (result=to_send,) we decode:

>>> result=received.decode('utf-8')
>>> result
u'eggs and ham'

You have transfered a unicode string. {:)}=

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to