[Python-modules-team] Bug#611923: python-xdg: wrong behaviour breaking apps on non-supported locale
Yann Dirson
ydirson at free.fr
Thu Feb 3 19:56:17 UTC 2011
Package: python-xdg
Version: 0.19-2
Severity: normal
If I open a translated desktop file with LC_ALL=fr_FR.UTF-8, the
following works as expected (ipython session):
In [1]: import xdg.DesktopEntry
In [3]: e=xdg.DesktopEntry.DesktopEntry()
In [4]: e.parse('plugins/Games/Chess.desktop')
In [5]: e.getName()
Out[5]: u'\xc9checs'
In [6]: print "%s" % e.getName()
------> print("%s" % e.getName())
Ãchecs
Now, if I use LC_ALL=fr_FR or fr_FR.ISO-8859-1 (which should be
equivalent), the final step instead throws:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xc9' in position 0: ordinal not in range(128)
It clearly fails to guess the correct charset to use.
By contrast, other programs in the same condition fallback to C
locale, which results in no error. I guess the xdg module should do
something similar.
-- System Information:
Debian Release: 6.0
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.34.1-00003-ge5b0813-dirty (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages python-xdg depends on:
ii python 2.6.6-3+squeeze5 interactive high-level object-orie
ii python-support 1.0.10 automated rebuilding support for P
python-xdg recommends no packages.
python-xdg suggests no packages.
-- no debconf information
More information about the Python-modules-team
mailing list