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._build_localename treatment for utf8
Type: behavior Stage: resolved
Components: Library (Lib), Unicode Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: locale.normalize strips "-" from UTF-8, which fails on Mac
View: 10154
Assigned To: lemburg Nosy List: hyeshik.chang, lemburg, serhiy.storchaka, spuk
Priority: normal Keywords: patch

Created on 2005-04-04 17:29 by hyeshik.chang, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
utf8localefix.diff hyeshik.chang, 2005-04-04 17:31 a proposed patch
Messages (5)
msg48150 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2005-04-04 17:29
Due to encoding name normalization of locale module,
UTF-8 locales are normalized to xx_XX.UTF8.  But most
of BSD systems and some other *nixes doesn't allow
normalized forms of locale names such as xx_XX.UTF8. 
So we need to restore the name on _build_localename to
'UTF-8' to make it work on such systems.

>>> import os; os.environ['LC_ALL']='ko_KR.UTF-8'
[25369 refs]
>>> import locale; locale.resetlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/perky/cvs/python/Lib/locale.py", line
402, in resetlocale
    _setlocale(category,
_build_localename(getdefaultlocale()))
locale.Error: unsupported locale setting
[28822 refs]
msg83184 - (view) Author: Gustavo De Nardin (spuk) (spuk) Date: 2009-03-05 09:00
We hit this problem with system-config-printer in Mandriva Linux
(<https://qa.mandriva.com/show_bug.cgi?id=48158>). Fixed it with this
patch
http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/python/current/SOURCES/python-2.5.2-fix_UTF-8_name.patch?view=log

The "UTF8" name was introduced here
<http://svn.python.org/view?view=rev&revision=38027> (4 years and 2
months ago), to account for libc expectations, which seem to have
changed again currently.

This also seems related or the same as
<http://bugs.python.org/issue1699853>.
msg114492 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-21 13:02
Would someone please look at the two line patch as svn wouldn't let me apply it.
msg185740 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2013-04-01 15:49
Presumably this patch should be accompanied by an equivalent for _localemodule.c, or am I in cloud cuckoo land?

FTR #1699853 referenced above is closed but it refers to #10466 which is Windows specific.
msg228185 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-02 08:28
This issue is already fixed (see issue10154 and issue10090).
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41804
2014-10-02 08:28:35serhiy.storchakasetstatus: open -> closed

superseder: locale.normalize strips "-" from UTF-8, which fails on Mac

nosy: + serhiy.storchaka
messages: + msg228185
resolution: duplicate
stage: patch review -> resolved
2014-02-03 18:37:11BreamoreBoysetnosy: - BreamoreBoy
2013-04-01 15:49:46BreamoreBoysetmessages: + msg185740
2010-08-21 13:02:13BreamoreBoysetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
nosy: + BreamoreBoy

messages: + msg114492

stage: test needed -> patch review
2009-03-05 09:00:33spuksetnosy: + spuk
messages: + msg83184
2009-02-16 03:16:41ajaksu2setcomponents: + Unicode
2009-02-15 22:15:52ajaksu2setstage: test needed
type: behavior
components: + Library (Lib), - Extension Modules
versions: + Python 2.6, - Python 2.5
2005-04-04 17:29:30hyeshik.changcreate