Unicode problems, yet again

Ivan Voras ivoras at something.ortheother
Sat Apr 23 21:15:02 EDT 2005


I have a string fetched from database, in iso8859-2, with 8bit 
characters, and I'm trying to send it over the network, via a socket:

   File "E:\Python24\lib\socket.py", line 249, in write
     data = str(data) # XXX Should really reject non-string non-buffers
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0161' in 
position 123: ordinal not in range(128)

The other end knows it should expect this encoding, so how to send it?

(Does anyone else feel that python's unicode handling is, well... 
suboptimal at least?)



More information about the Python-list mailing list