[issue19341] locale.getdefaultencoding() returns wrong locale and encoding for ca_ES at valencia

David Planella report at bugs.python.org
Tue Oct 22 09:27:59 CEST 2013


New submission from David Planella:

It seems getdefaultlocale does not return the correct encoding when the locale is set to ca_ES at valencia:

>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'LC_CTYPE=ca_ES.UTF-8 at valencia;LC_NUMERIC=ca_ES.UTF-8;LC_TIME=ca_ES.UTF-8;LC_COLLATE=ca_ES.UTF-8 at valencia;LC_MONETARY=ca_ES.UTF-8;LC_MESSAGES=ca_ES.UTF-8 at valencia;LC_PAPER=ca_ES.UTF-8;LC_NAME=ca_ES.UTF-8;LC_ADDRESS=ca_ES.UTF-8;LC_TELEPHONE=ca_ES.UTF-8;LC_MEASUREMENT=ca_ES.UTF-8;LC_IDENTIFICATION=ca_ES.UTF-8'
>>> 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 at 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. at valencia':                      'ca_ES at valencia.UTF-8',

----------
components: Library (Lib)
messages: 200886
nosy: dpm
priority: normal
severity: normal
status: open
title: locale.getdefaultencoding() returns wrong locale and encoding for ca_ES at valencia
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19341>
_______________________________________


More information about the Python-bugs-list mailing list