Error setting locale in python

Harald Hanche-Olsen hanche at math.ntnu.no
Fri Jul 23 02:14:30 PDT 2010


+ Brandon S Allbery KF8NH <allbery at kf8nh.com>:

> As such, you might try setting LANG and LC_ALL to C instead, in
> case the iconv library you're using doesn't parse set-but-empty environment
> variables correctly.

Good catch! (Uh, setting LC_ALL to C would override my LC_CTYPE
setting, would it not? But nevermind.) So this works:

; env - LC_CTYPE\=en_US.UTF-8 LANG\=C PATH\=$PATH python2.6
Python 2.6.5 (r265:79063, Jul 16 2010, 21:35:10) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL,'')
'C/en_US.UTF-8/C/C/C/C'
>>>

Now at least I have a workaround, but it's still a bug.
Shall I assume the bug is in libiconv then?
(But iconv the program does not complain.)

- Harald


More information about the macports-users mailing list