[maemo-developers] Python - problem with locales
From: David Hautbois david.hautbois at free.frDate: Mon Oct 8 20:43:03 EEST 2007
- Previous message: Python - problem with locales
- Next message: Python - problem with locales
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Lauro Moura wrote: > On 10/6/07, David Hautbois <david.hautbois at free.fr> wrote: > >> Hi >> >> Thanks for your tips, but I still have problem : >> >> ***** unset LC_ALL >> >>> import locale >> >>> locale.getdefaultlocale() >> (None, None) >> >> Error: >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in >> position 54: ordinal not in range(128) >> >> ***** export LC_ALL="en_US.UTF-8" (Like my debian workstation) >> >>> locale.getdefaultlocale() >> ('en_US', 'UTF8') >> >> Error: >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in >> position 54: ordinal not in range(128) >> >> ***** export LC_ALL="fr_FR.UTF-8" >> >>> locale.getdefaultlocale() >> ('fr_FR', 'UTF8') >> >> Error: >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in >> position 54: ordinal not in range(128) >> >> > > Hi David, > > Could you paste the output of the following script to show LC_ALL, > LC_CTYPES, LANG and LANGUAGE? > http://pastebin.com/f16db283 > > My scratchbox shows LC_ALL=C and everything else undefined, leading to > that UnicodeEncodeError. If I reproduce these values in my Ubuntu > desktop, the same error occurs. > > To work correctly, I had to unset LC_ALL (bigger precedence) and set > LANG to en_US.UTF-8. > > PS: This still differs from ubuntu, where I had to set LANG to > en_GB.UTF-8 (not just en_GB) and this config fails on scratchbox (I'm > working on it). > > The ouput of your script : [sbox-SDK_X86: ~] > ./tmp.py LC_ALL: C LC_CTYPES not defined LANG not defined LANGUAGE not defined Traceback (most recent call last): File "./tmp.py", line 18, in <module> main() File "./tmp.py", line 15, in main print u"\u2014" UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 0: ordinal not in range(128) On my debian workstation : david at saturne:/scratchbox/users/david/home/david$ ./tmp.py LC_ALL not defined LC_CTYPES not defined LANG: en_US.UTF-8 LANGUAGE not defined — So in Scratchbox, I set LANG to en_US.UTF-8 : [sbox-SDK_X86: ~] > ./tmp.py LC_ALL not defined LC_CTYPES not defined LANG: en_US.UTF-8 LANGUAGE not defined Traceback (most recent call last): File "./tmp.py", line 18, in <module> main() File "./tmp.py", line 15, in main print u"\u2014" UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 0: ordinal not in range(128) I tried too : LANG=en_GB and LANGUAGE=en_GB and LANGUAGE=en_US.UTF-8 Nothing works.... Thanks. David. -- http://david.hautbois.free.fr http://slugplayer.free.fr
- Previous message: Python - problem with locales
- Next message: Python - problem with locales
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]