From 4fe43a809963d664c75fd17759f76ee197411dc5 Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Tue, 20 Sep 2005 07:03:21 +0000 Subject: - Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct encoding. - Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of languages. --- Lib/locale.py | 4 +++- Misc/NEWS | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Lib/locale.py b/Lib/locale.py index a231810..c52e5d2 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -293,7 +293,7 @@ def _build_localename(localetuple): else: return language + '.' + encoding -def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): +def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): """ Tries to determine the default locale settings and returns them as tuple (language code, encoding). @@ -338,6 +338,8 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): for variable in envvars: localename = lookup(variable,None) if localename: + if variable == 'LANGUAGE': + localename = localename.split(':')[0] break else: localename = 'C' diff --git a/Misc/NEWS b/Misc/NEWS index c8d6278..cc1252d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -96,6 +96,12 @@ Extension Modules Library ------- +- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE + to get the correct encoding. + +- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of + languages. + - Patch #1268314: Cache lines in StreamReader.readlines for performance. - Bug #1290505: time.strptime() was not invalidating its regex cache when the -- cgit v0.12