Issue 1553427: locale.getdefaultlocale() bug when _locale is missing (original) (raw)
locale.getdefaultlocale() is not able to get my terminal charset when _locale is missing.
My variable environement (I'm using Kubuntu Dapper): $ env|egrep '(LANG|LC_)' LANG=fr_FR.UTF-8 LANGUAGE=fr_FR:fr:en_GB:en
The problem is that locale.getdefaultlocale() try to use LANGUAGEbeforeLANGUAGE before LANGUAGEbeforeLANG, and $LANGUAGE don't contain charset information.
So I choosed to test LANGUAGE as last change, and backport Python 2.5c1 patch (just use first language from $LANGUAGE: localename = localename.split(':') [0]).
The bug should be in Python 2.x (at least 2.4.x and 2.5.x).
Haypo