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: calendar.LocaleHTMLCalendar.formatyearpage() results in traceback with 'unsupported locale setting' on Windows
Type: behavior Stage: resolved
Components: Versions: Python 3.1, Python 3.2, Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: Calendar Problem with Windows (XP)
View: 21731
Assigned To: Nosy List: belopolsky, ned.deily, r.david.murray, ruseel, skoczian
Priority: normal Keywords: easy, patch

Created on 2010-11-22 02:35 by r.david.murray, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue10498.patch ruseel, 2010-11-24 05:08 patch and unittest
Messages (7)
msg122070 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-11-22 02:35
See issue 10466 for background, but in short LocaleHTMLCalendar uses getdefaultlocale if no locale is specified, and on windows this results in a locale that setlocale will not accept.  The fix is presumably to use setlocale(LC_DATE, '') instead of getdefaultelocale.
msg122072 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-11-22 02:38
See also #10087.
msg122092 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-22 04:29
Fails on OS X as well for similar reasons.
msg122260 - (view) Author: MunSic JEONG (ruseel) Date: 2010-11-24 05:08
On OSX, _locale.setlocale raise locale.Error with arg 'UTF8' but ok with 'UTF-8'. and setlocale tries to normalize localename with locale.normalize(). and locale.normalize() always change encoding to 'UTF8' ( 

So changes in locale.normalize could fix this issue at least on OSX. 

patch and unittest against p3k is attached.

I did not search why normalize() changes 'utf_8' to 'UTF8' until now. but I would post if I get answer in subversion log.
msg122265 - (view) Author: MunSic JEONG (ruseel) Date: 2010-11-24 07:56
r38027 has following changes.

-    'utf-8':                        'UTF-8',
+    'utf_8':                        'UTF8',

subversion log is:

Correct mapping of Python codec name to C encoding name for UTF-8 (the C lib doesn't seem to like "UTF-8").
msg122266 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-24 09:49
Your analysis is correct.  Sorry, I should have noted that the OS X "UTF8" vs "UTF-8" discrepancy has already been discussed in Issue10090 and Issue10154.
msg220351 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-12 13:36
I'm closing this in favor of issue 21731, which has a proposed (though I believe incorrect) patch.
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54707
2014-06-12 13:36:00r.david.murraysetstatus: open -> closed
superseder: Calendar Problem with Windows (XP)
messages: + msg220351

resolution: duplicate
stage: test needed -> resolved
2010-11-24 09:49:36ned.deilysetmessages: + msg122266
2010-11-24 07:56:47ruseelsetmessages: + msg122265
2010-11-24 05:08:35ruseelsetfiles: + issue10498.patch
keywords: + patch
messages: + msg122260
2010-11-23 04:36:09ruseelsetnosy: + ruseel
2010-11-22 04:29:05ned.deilysetnosy: + ned.deily
messages: + msg122092
2010-11-22 02:38:58belopolskysetnosy: + belopolsky
messages: + msg122072
2010-11-22 02:37:09r.david.murraysetnosy: + skoczian
2010-11-22 02:35:03r.david.murraycreate