New submission from Jean-Paul Calderone <[email protected]>:
Consider this transcript from OS X 10.6:
>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.setlocale(locale.LC_ALL, _)
'C'
>>> locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
'en_US.UTF-8'
>>> locale.getlocale()
('en_US', 'UTF8')
>>> locale.setlocale(locale.LC_ALL, _)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/locale.py",
line 494, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>>
OS X does not recognize 'en_US.UTF8', only 'en_US.UTF-8'. However, when passed
a tuple, the locale module tries to normalize the values. It ends up turning
the result of getlocale from ('en_US', 'UTF-8') into 'en_US.UTF8'.
----------
assignee: ronaldoussoren
components: Extension Modules, Library (Lib), Macintosh
messages: 139445
nosy: exarkun, ronaldoussoren
priority: normal
severity: normal
status: open
title: locale.setlocale(locale.LC_ALL, locale.getlocale()) fails for some
locales
type: behavior
versions: Python 2.6, Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com