ascii to latin1

Richie Hindle richie at entrian.com
Tue May 9 06:41:34 EDT 2006


[Serge]
> 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'))

Lovely bit of code - thanks for posting it!

You might want to use "NFKD" to normalize things like LATIN SMALL
LIGATURE FI and subscript/superscript characters as well as diacritics.

-- 
Richie Hindle
richie at entrian.com



More information about the Python-list mailing list