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.

Author barry
Recipients barry, ezio.melotti, jtaylor, lemburg
Date 2011-08-15.20:47:47
SpamBayes Score 1.1143756e-05
Marked as misclassified No
Message-id <1313441268.59.0.550674484357.issue12752@psf.upfronthosting.co.za>
In-reply-to
Content
For example:


diff -r fb49394f75ed Lib/locale.py
--- a/Lib/locale.py	Mon Aug 15 14:24:15 2011 +0300
+++ b/Lib/locale.py	Mon Aug 15 16:47:23 2011 -0400
@@ -355,6 +355,8 @@
 
     """
     # Normalize the locale name and extract the encoding
+    if isinstance(localename, unicode):
+        localename = localename.encode('ascii')
     fullname = localename.translate(_ascii_lower_map)
     if ':' in fullname:
         # ':' is sometimes used as encoding delimiter.
diff -r fb49394f75ed Lib/test/test_locale.py
--- a/Lib/test/test_locale.py	Mon Aug 15 14:24:15 2011 +0300
+++ b/Lib/test/test_locale.py	Mon Aug 15 16:47:23 2011 -0400
@@ -412,6 +412,11 @@
         locale.setlocale(locale.LC_CTYPE, loc)
         self.assertEqual(loc, locale.getlocale())
 
+    def test_normalize_issue12752(self):
+        # Issue #1813 caused a regression where locale.normalize() would no
+        # longer accept unicode strings.
+        self.assertEqual(locale.normalize(u'en_US'), 'en_US.ISO8859-1')
+
 
 def test_main():
     tests = [
History
Date User Action Args
2011-08-15 20:47:48barrysetrecipients: + barry, lemburg, ezio.melotti, jtaylor
2011-08-15 20:47:48barrysetmessageid: <1313441268.59.0.550674484357.issue12752@psf.upfronthosting.co.za>
2011-08-15 20:47:48barrylinkissue12752 messages
2011-08-15 20:47:47barrycreate