[Python-Dev] str.ascii_lower (original) (raw)

Guido van Rossum guido at python.org
Mon Dec 29 12:47:39 EST 2003


This post caused me to notice the following behavior. Is it "right"?

>>> import locale >>> locale.setlocale(locale.LCCTYPE, "trTR") 'trTR' >>> locale.getlocale()[1] # Expected charset 'ISO8859-9' >>> "I".lower() # Expected behavior '\xfd' >>> u"I".lower() # Python bug? (should be u'\u0131') u'i'

Why? Unicode strings are not affected by the locale.

>>> locale.setlocale(locale.LCCTYPE, "trTR.UTF-8") 'trTR.UTF-8' >>> "I".lower() # C library bug? (should be "\xc4\xb1")* 'I' >>> locale.setlocale(locale.LCCTYPE, "enUS.UTF-8") 'enUS.UTF-8' >>> "I".lower() # (UTF-8 locale works properly in english) 'i'

I have no idea what adding UTF8 to the local means. Is this something that Python's locale-awareness does or is it simply recognized by the C library?

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list