ascii to latin1

Richie Hindle rjh at cyberscience.com
Tue May 9 14:48:29 CEST 2006


[Luis]
> When I used the "NFD" option, I came across many errors on these and
> possibly other codes: \xba, \xc9, \xcd.

What errors?  This works fine for me, printing "Ecoute":

import unicodedata
def search_key(s):
    de_str = unicodedata.normalize("NFD", s)
    return ''.join([cp for cp in de_str if not
                    unicodedata.category(cp).startswith('M')])
print search_key(u"\xc9coute")

Are you using unicode code point \xc9, or is that a byte in some
encoding?  Which encoding?

-- 
Richie



More information about the Python-list mailing list