unicode and socket
Irmen de Jong
irmen.NOSPAM at xs4all.nl
Fri Feb 18 16:52:50 EST 2005
Irmen de Jong wrote:
> aurora wrote:
>
>> You could not. Unicode is an abstract data type. It must be encoded
>> into octets in order to send via socket. And the other end must
>> decode the octets to retrieve the unicode string. Needless to say the
>> encoding scheme must be consistent and understood by both ends.
>
>
> So use pickle.
>
> --Irmen
Well, on second thought: don't use pickle.
If all you want to transfer is unicode strings (or normal strings)
it's safer to just encode them to, say, UTF-8, transfer
that octet stream across, and on the other side, decode the
UTF-8 octets back into a unicode string.
--Irmen
More information about the Python-list
mailing list