[Patches] [ python-Patches-1166948 ] locale.getdefaultencoding: precedence of LANGUAGE / LANG

SourceForge.net noreply at sourceforge.net
Sun Mar 20 14:11:25 CET 2005


Patches item #1166948, was opened at 2005-03-20 14:11
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1166948&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: locale.getdefaultencoding: precedence of LANGUAGE / LANG

Initial Comment:
locale.getdefaultencoding checks first LANGUAGE, then
the LC_* and LANG variables. Assume LANGUAGE is set to
en:de, and LANG to en_US.utf-8, then getdefaultencoding
returns the wrong encoding (ISO8859-1).

AFAIK, LANGUAGE is specific to gettext (GNU extension),
and IMO should not interfer with getting the correct
encoding.

This patch uses LANGUAGE as the choice with the lowest
priority, so the other variables to determine the
locale and encoding take precedence (LC_ALL, LC_CTYPE,
LANG).

There's another (minor) bug in the implementation:
LANGUAGE is honoured even if the default locale is "C".


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1166948&group_id=5470


More information about the Patches mailing list