classification
Title: locale.getdefaultlocale() bug when _locale is missing
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, haypo
Priority: normal Keywords: patch

Created on 2006-09-06 14:00 by haypo, last changed 2007-06-18 19:34 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
pypy_09_locale_getdefaultlocale.patch haypo, 2006-09-06 14:00 Fix locale.getdefaultlocale() (patch for Python 2.4.x, just change 3 lines)
Messages (2)
msg51097 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2006-09-06 14:00
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 $LANGUAGE before $LANG, 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
msg51098 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-06-18 19:34
Fixed in 2.5.1 according to the reporter.
History
Date User Action Args
2006-09-06 14:00:57haypocreate