On OS/X 10.6, Apple have defined the LC_CTYPE environment variable as 'UTF-8'.
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
LC_CTYPE is meant to specify the encoding for the locale as well as the character properties, yet UTF-8 defines only the encoding. This can lead to problems with internationalisation in software, like Python's Babel module which throws a ValueError exception:-
ValueError: expected only letters, got 'utf-8'
This can be fixed by changing the LC_CTYPE value to include the character properties by specifying the country/language portion as well:-
export LC_CTYPE="en_CA.utf-8"
You may want to add it to your .profile to make the change permanent:-
echo "LC_CTYPE='en_CA.utf-8'" >> ~/.profile
Ideally Apple are the ones who need to fix this.
No comments:
Post a Comment