Menu

#14 Problem with sending utf8

open
nobody
None
5
2004-04-27
2004-04-27
Anonymous
No

I've got problem sending utf8-encoded text. Here is the
relevant traceback (test_client.py is self-modified
version):

File "./test_client.py", line 122, in sendMessage
self.conn.send(msg)
File "/usr/lib/python2.3/site-packages/jabber.py", line
246, in send
xmlstream.Client.write(self,ustr(what))
File "/usr/lib/python2.3/site-packages/jabber.py", line
184, in ustr
try: r = what.__str__()
File "/usr/lib/python2.3/site-packages/xmlstream.py",
line 176, in __str__
return self._xmlnode2str()
File "/usr/lib/python2.3/site-packages/xmlstream.py",
line 193, in _xmlnode2str
s = s + a._xmlnode2str(parent=self)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3
in position 59: ordinal not in range(128)

The text I'm trying to send includes latin-1 or other
non-ascii characters. The error starts with the first value
which goes over the ascii range. Here it happens to be ö
(ouml), which is hex c3b6 in utf8. The same thing
happens also with 3-byte values, e.g. unicode character
U+2019 (not latin-1).

Sending characters with ascii equivalents works.

I use Debian unstable, python 2.3, jabber.py 5.0. Locale
is iso-8859-15.

eekaikko@mail.student.oulu.fi

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Try to specify your encoding in the xmlstream module.
    Or do apt-get install python-xmpp ;)

     

Log in to post a comment.

MongoDB Logo MongoDB