This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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, vstinner
Priority: normal Keywords: patch

Created on 2006-09-06 14:00 by vstinner, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
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_)'
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
2022-04-11 14:56:20adminsetgithub: 43950
2006-09-06 14:00:57vstinnercreate