Comment 4 for bug 748964

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

For me it looks like this is a problem of Python. I can reproduce the error by directly calling Python:

till@till:~$ LC_ALL=C python -c 'import locale; print locale.setlocale (locale.LC_ALL, "")'
C
till@till:~$ LC_ALL=en_US.UTF-8 python -c 'import locale; print locale.setlocale (locale.LC_ALL, "")'
en_US.UTF-8
till@till:~$ LC_ALL=de_DE.UTF-8 python -c 'import locale; print locale.setlocale (locale.LC_ALL, "")'
de_DE.UTF-8
till@till:~$ LC_ALL=en_US python -c 'import locale; print locale.setlocale (locale.LC_ALL, "")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/locale.py", line 531, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
till@till:~$ LC_ALL=de_DE python -c 'import locale; print locale.setlocale (locale.LC_ALL, "")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/locale.py", line 531, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
till@till:~$

This means that Python accepts locales with "UTF-8" specification but not without.

I am not a locale expert so I do not know what really needs to get fixed in Python or in Ubuntu's locales, but a workaround in system-config-printer by surrounding locale.setlocale() with "try: ... except: ..." could solve the problem. Tim, WDYT?