Replace accented chars with unaccented ones

Michael Hudson mwh at
Tue Mar 16 12:15:30 CET 2004

Jeff Epler <jepler at> writes:

> You have two options.  First, convert the string to Unicode and use code
> like the following:
>     replacements = [(u'\xe9', 'e'), ...]
>     def remove_accents(u):
>         for a, b in replacements:
>             u = u.replace(a, b)
>         return u

There must be some more high powered way of doing this... something

def remove_accent1(c):
    return unicodedata.normalize('NFD', c)[0]
def remove_accents(s):
    return u''.join(map(remove_accent1, s))



  We've had a lot of problems going from glibc 2.0 to glibc 2.1.
  People claim binary compatibility.  Except for functions they
  don't like.                       -- Peter Van Eynde, comp.lang.lisp

More information about the Python-list mailing list