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

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

File name Uploaded Description Edit
pypy_09_locale_getdefaultlocale.patch vstinner, 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 (vstinner) * (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_)'

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(':')

The bug should be in Python 2.x (at least 2.4.x and 

msg51098 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-06-18 19:34
Fixed in 2.5.1 according to the reporter.
Date User Action Args
2006-09-06 14:00:57vstinnercreate