Uppercase/Lowercase on unicode

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jun 5 11:59:07 CEST 2009


En Fri, 05 Jun 2009 06:39:31 -0300, Kless <jonas.esp at googlemail.com>  
escribió:

> Is there any librery that works ok with unicode at converting to
> uppercase or lowercase?
>
> --------------
>>>> foo = u'áèïöúñ'
>
>>>> print(foo.upper())
> áèïöúñ
> --------------

Looks like Python thinks your terminal uses utf-8, but it actually uses  
another encoding (latin1?)
Or, you saved the script as an utf-8 file but the encoding declaration  
says otherwise.

This works fine for me:

py> foo = u'áèïöúñ'
py> print foo
áèïöúñ
py> print foo.upper()
ÁÈÏÖÚÑ

-- 
Gabriel Genellina




More information about the Python-list mailing list