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.

Title: locale.getdefaultencoding() returns wrong locale and encoding for ca_ES@valencia
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: locale.getdefaultlocale() missing corner case
View: 5815
Assigned To: Nosy List: dpm, serhiy.storchaka
Priority: normal Keywords:

Created on 2013-10-22 07:27 by dpm, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg200886 - (view) Author: David Planella (dpm) Date: 2013-10-22 07:27
It seems getdefaultlocale does not return the correct encoding when the locale is set to ca_ES@valencia:

>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
>>> locale.getdefaultlocale()
('ca_ES', 'utf_8_valencia')

Instead of 'utf_8_valencia', here I'd expect 'UTF-8' to be returned. The returned locale is also wrong: it should be ca_ES@valencia.

Looking quickly at the locale module's source code, it seems that the following item should be added to the locale_alias dict?

   'ca_es.@valencia':                      'ca_ES@valencia.UTF-8',
msg200919 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-22 11:40
This is a duplicate of issue5815.
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63540
2013-10-22 11:40:53serhiy.storchakasetstatus: open -> closed

superseder: locale.getdefaultlocale() missing corner case

nosy: + serhiy.storchaka
messages: + msg200919
resolution: duplicate
stage: resolved
2013-10-22 07:27:59dpmcreate