| Issue 44: | Can't decode utf8 | |
| Back to list |
Posted by guest at 2006-09-27 15:28:45 Sry posted this in the wrong place: http://www.blathersource.org/bugs_view.php?projid=pyaim-t&bugid=221 But the problem still exists, i also posted a ugly workaround. /R Posted by guest at 2006-09-28 18:22:40 Ops my bug-fix had a bug ;-) Here is the working version: try: tmp = unicode(nickname, "utf8") except (TypeError): # Already in unicode tmp = nickname pass except (UnicodeDecodeError): # Not utf-8 encoding. try: tmp = unicode(nickname, "iso8859-1") except (UnicodeDecodeError): # Not iso8859-1 encoding try: tmp = unicode(nickname, "utf8", "ignore") # Last chance except: # Should realy never come here. LogEvent(ERROR, "", "Got an ape, the string is %s" % repr(nickname)) tmp = u"apa" # We got an ape. pass /R
Jan 12, 2008
Project Member
#1
volk...@gmail.com
Status:
Fixed
|