Is unicode.lower() locale-independent?

Robert Kern robert.kern at gmail.com
Sat Jan 12 17:44:27 EST 2008


Fredrik Lundh wrote:
> Robert Kern wrote:
> 
>>> However it appears from your bug ticket that you have a much narrower
>>> problem (case-shifting a small known list of English words like VOID)
>>> and can work around it by writing your own locale-independent casing
>>> functions. Do you still need to find out whether Python unicode
>>> casings are locale-dependent?
>> I would still like to know. There are other places where .lower() is used in 
>> numpy, not to mention the rest of my code.
> 
> "lower" uses the informative case mappings provided by the Unicode 
> character database; see
> 
>      http://www.unicode.org/Public/4.1.0/ucd/UCD.html
> 
> afaik, changing the locale has no influence whatsoever on Python's 
> Unicode subsystem.

Even if towlower() gets used? I've found an explicit statement that the 
conversion it does can be locale-specific:

   http://msdn2.microsoft.com/en-us/library/8h19t214.aspx

Thanks, Fredrik.

-- 
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