beznogno / pyicqt

Automatically exported from code.google.com/p/pyicqt
GNU General Public License v2.0
0 stars 0 forks source link

"exceptions.TypeError: decoding Unicode is not supported" when non-latin nickname #128

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a contact who has specified non-latin nickname on the ICQ server
2. request "User info" for this contact
3. you will be kicked off, with error trace in the log (specify "-d" option)

What is the expected output? What do you see instead?

-

What version of the product are you using? On what operating system?

Version: 0.8a-4
.deb package on Debian etch

Please provide any additional information below.

=====
          File "/usr/share/jabber-pyicq/src/legacy/icqt.py", line 80, in
gotUserInfo
            self.oscarcon.gotvCard(self.oscarcon.userinfoCollection[id])
          File "/usr/share/jabber-pyicq/src/legacy/glue.py", line 497, in
gotvCard
            self.legacyList.updateNickname(usercol.userinfo, usercol.nick)
          File "/usr/share/jabber-pyicq/src/legacy/buddies.py", line 170,
in updateNickname
            c.updateNickname(nick, push=True)
          File "/usr/share/jabber-pyicq/src/contact.py", line 145, in
updateNickname
            if unicode(self.nickname, errors='replace') != "nickname":
        exceptions.TypeError: decoding Unicode is not supported
========

Apparently when Contact.updateNickname is called, the argument has been
already converted to UTF-8. When a unicode object is passed to "unicode"
function, Python raises exception *even* if you specify "errors='replace'".
This can be verified by trying to execute "unicode(u'',errors='replace')"

The following diff helps, though I don't know how "correct" it is"

--- src/contact.py.orig 2008-01-23 16:56:23.000000000 +0300
+++ src/contact.py      2008-01-23 17:03:02.000000000 +0300
@@ -142,7 +142,7 @@
                        self.contactList.legacyList.deauthContact(self.jid)

        def updateNickname(self, nickname, push=True):
-               if unicode(self.nickname, errors='replace') != "nickname":
+               if self.nickname != "nickname":
                        self.nickname = nickname
                        # will re-remove this if it's removed from JEP-0172.
                        #self.sendNickname()

Original issue reported on code.google.com by egcros...@gmail.com on 23 Jan 2008 at 2:30

GoogleCodeExporter commented 9 years ago
It seems fixed in nearly released 0.8b

Original comment by maxim.br...@gmail.com on 28 Jan 2008 at 8:25

GoogleCodeExporter commented 9 years ago
Yes - this is fixed in 0.8b (SVN changeset 230).

Original comment by d...@jabber.fsinf.de on 29 Jan 2008 at 8:20