'ValueError: unknown locale: UTF-8' problem in Mac OS X 10.5 Leopard [solved (more or less)]
Oscar Sanchez Casamitjana
osc.lists at gmail.com
Mon Oct 29 04:42:42 CDT 2007
On 10/29/07, Jay Soffian <jaysoffian+hg at gmail.com> wrote:
> > I'm not an expert, but that doesn't appear to be a valid value for
> > LANG. It needs to consist of a language code optionally followed by a
> > "." and an encoding. Not just an encoding.
>
> Indeed. With 2.4:
>
> callisto:~% env - LANG=UTF-8 /opt/local/bin/python -c 'import
> sys,locale; print sys.version; print locale.getdefaultlocale()'
> 2.4.4 (#1, Oct 26 2007, 00:01:28)
> [GCC 4.0.1 (Apple Computer, Inc. build 5363)]
> (None, 'mac-roman')
>
> With 2.5:
>
> callisto:~% env - LANG=UTF-8 /usr/bin/python -c 'import sys,locale;
> print sys.version; print locale.getdefaultlocale()'
> 2.5.1 (r251:54863, Oct 5 2007, 21:08:09)
> [GCC 4.0.1 (Apple Inc. build 5465)]
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py",
> line 441, in getdefaultlocale
> return _parse_localename(localename)
> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py",
> line 373, in _parse_localename
> raise ValueError, 'unknown locale: %s' % localename
> ValueError: unknown locale: UTF-8
thanks Jay! I finally solved my problem adding this to my bash profile:
export LC_ALL=es_ES.UTF-8
export LANG=es_ES.UTF-8
now I can 'hg whatever' and use out-of-ASCII chars.
but now I don't understand what's the point of "Set LANG environment
variable on startutp" preference in Terminal.app :(
here's some info on this locale thing:
http://www.madboa.com/geek/utf8/
thanks everybody,
oscar.
More information about the Mercurial
mailing list