Problem with encoding

Bach bachhx at
Wed Aug 21 06:24:20 EDT 2002

There are a problem when I write program in Python2.2 (I try modify for that):

    1)create a socket:   self._sock=socket.socket(...)
    2)Initialaze :data_in = u''
    3)Get data: data_in = data_in + 

 I want to get the data from socket (data send by another "correct"
 program with encode UTF-8 ) and convert to Unicode.When I try to
 get Russian letters make an error: UnicodeError: ASCII encoding
 error: ordinal not in range(128).

My program :Create a jabber-client which could send and receive data
in UTF-8  encode.

Idea:1)Send data :Convert data to unicode --> Encode in UTF-8 --> Send
                  u_data=unicode(data)  ;_sock.send(u_data.encode)  
     2)Receive: Get data -->convert to unicode 

More information about the Python-list mailing list