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.getdefaultencoding: precedence of LANGUAGE / LANG
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: doko, georg.brandl
Priority: normal Keywords: patch

Created on 2005-03-20 13:11 by doko, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
locale2.diff doko, 2005-03-20 13:11
Messages (3)
msg48010 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2005-03-20 13:11
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".
msg48011 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-01 17:04
Logged In: YES 
user_id=1188172

This file is one big patch for #1166938, #1166948 and #1166957.
msg48012 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2005-09-20 07:06
Logged In: YES 
user_id=60903

checked in as
  Lib/locale.py: 1.32 (HEAD)
  Lib/locale.py: 1.28.4.2 (2.4 branch)

History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41726
2005-03-20 13:11:25dokocreate