Is unicode.lower() locale-independent?

Robert Kern robert.kern at gmail.com
Sat Jan 12 10:25:52 CET 2008


The section on "String Methods"[1] in the Python documentation states that for 
the case conversion methods like str.lower(), "For 8-bit strings, this method is 
locale-dependent." Is there a guarantee that unicode.lower() is 
locale-*in*dependent?

The section on "Case Conversion" in PEP 100 suggests this, but the code itself 
looks like to may call the C function towlower() if it is available. On OS X 
Leopard, the manpage for towlower(3) states that it "uses the current locale" 
though it doesn't say exactly *how* it uses it.

This is the bug I'm trying to fix:

   http://scipy.org/scipy/numpy/ticket/643
   http://dev.laptop.org/ticket/5559

[1] http://docs.python.org/lib/string-methods.html
[2] http://www.python.org/dev/peps/pep-0100/

Thanks.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list