mariano / snakefire

A Linux desktop client for Campfire
http://snakefire.org
MIT License
99 stars 24 forks source link

UnicodeEncodeError in mainframe.py for non-ascii characters #29

Open bf4 opened 12 years ago

bf4 commented 12 years ago

e.g. from the log

self.statusBar().showMessage(self._("Joining room {room}...").format(room=room["name"])) UnicodeEncodeError: 'ascii' codec can't encode character u'\xeb' in position 1: ordinal not in range(128)

this results in not being able to perform most actions in the room. It does display the room name properly in the select box, so I'm not sure what's different about these methods. In any case, the room is not currently useable. I tried adding .encode("ascii", "ignore") in various places as a hack but didn't find them all.

mariano commented 12 years ago

Could you give me the gave of the failing room so I can replicate?

bf4 commented 12 years ago

Nërd Lounge™

mariano commented 12 years ago

Weird, I created a room with that exact name, and I'm able to join it correctly. There is an issue with the status bar (I don't see the warning you see, but the room name is not properly shown when displaying the Joining room message). I'm fixing that issue

mariano commented 12 years ago

Try with the recent update (you have to pull from the GIT repo, since I haven't yet released packages for this)

bf4 commented 12 years ago

Will do tonight. thanks

bf4 commented 12 years ago

hmm, that didn't appear to fix it... $HOME/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/site-packages/snakefire-1.0.4-py2.7.egg/snakefire/mainframe.py", line 335, in joinRoom self.statusBar().showMessage(unicode(self._("Joining room {room}...").format(room=room["name"]))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xeb' in position 1: ordinal not in range(128)

bf4 commented 12 years ago

(I'm on OSX snowleopard FWIW)

bf4 commented 12 years ago

It looks like something to do with how .format is called and what the interpolation expects. I don't really know python, but from reading it about it, it appears the django module smart_str https://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/utils/encoding.py#L95 would help or maybe adding !r to the interpolated string, or see http://docs.python.org/tutorial/introduction.html e.g. u'Hello\u0020World !' u'Hello World !'

mariano commented 11 years ago

A related fix in #67 may have solved this. Could you test with latest git version? Thanks