Bug found in the latest release of pymsn : 0.3.3 Telepathy-butterfly version : 0.3.2 Trying to set an user alias containing special UTF-8 character such as "é" in french, does not work. Nothing happens on Empathy side. On the telepathy-butterfly side, when setting the alias using D-Feet via the SetAliases method of the connector, the following error is returned from Pymsn: org.freedesktop.DBus.Python.KeyError: Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/dbus/service.py", line 702, in _message_cb retval = candidate_method(self, *args, **keywords) File "/usr/lib/python2.5/site-packages/butterfly/aliasing.py", line 80, in SetAliases self.msn_client.profile.display_name = alias File "/usr/lib/python2.5/site-packages/pymsn/profile.py", line 395, in fset self._ns_client.set_display_name(display_name) File "/usr/lib/python2.5/site-packages/pymsn/util/decorator.py", line 111, in new_function func(*args, **kwargs) File "/usr/lib/python2.5/site-packages/pymsn/msnp/notification.py", line 147, in set_display_name ('MFN', urllib.quote(display_name))) File "/usr/lib/python2.5/urllib.py", line 1205, in quote res = map(safe_map.__getitem__, s) KeyError: u'\xe9' This seems to correspond to a mishandling of some utf-8 characters. When setting a user alias without any accent, for instance, it works flawlessly and it's propagated to the contacts.
Created attachment 21469 [details] [review] Utf-8 mishandling workaround patch The bug can be reproduced directly in a python shell: >>> import urllib >>> urllib.quote(u'Aurélien') /usr/lib/python2.5/urllib.py:1205: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal res = map(safe_map.__getitem__, s) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/urllib.py", line 1205, in quote res = map(safe_map.__getitem__, s) KeyError: u'\xe9' It seems to be a known problem: http://coding.derkeiler.com/Archive/Python/comp.lang.python/2008-10/msg00432.html Using the hint provided before, I create a patch that corrects this error. It mainly encode the utf-8 string before the quote.
pymsn expects all user strings to be utf-8 encoded string instances (not unicode instance). To me it seems that the program you are using is not using pymsn correctly.
Well, the application using it is the telepathy-butterly connector, the main and only application (to my knowlegde) using the pymsn library. Then, should this bug be assigned to the telepathy-butterfly team then, if you consider it's not a pymsn bug?
yes, please do as I am no longer the maintainer of telepathy-butterfly.
Created attachment 21494 [details] [review] tp-butterfly utf-8 mishandling user aliases patch Correct the mentionned bug but in the telepathy-butterfly source code. It's seems that indeed the encode method was missing as it was applied to alias for classic contact aliases. Works on 0.3.2 release of telepathy-butterfly
Reassigning it to the telepathy-butterfly team.
commit 43a961b920edf21f83e6478385d172fd9eb660aa Author: Jonny Lamb <jonny.lamb@collabora.co.uk> Date: Sun Dec 28 14:48:32 2008 +0000 Encode the user alias as UTF-8 when setting a new display name. "It seems that indeed the encode method was missing as it was applied to alias for classic contact aliases." Thanks to Aurélien Bauchet <baucheta@gmail.com> for the patch. Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.