Possible Duplicate:
What is the best way to remove accents in a python unicode string?
In a certain system, I need to generate usernames that are only allowed plain-ascii characters (a-z, 0-9, dashes). Many users have names however that don't simply match those restrictions, for example the German names "Müller" or "Röthlin".
Now those umlauts have an alternative way of typing them (I'm sure there's a name for it, but I don't know that - might help Googling)
A naive approach would be to employ a translation table:
name = name.replace('Ä', 'Ae')
name = name.replace('ä', 'ae')
name = name.replace('ö', 'oe')
and so forth.
This approach however fails as soon as you have users from cultures other than, say, German, where other characters might appear. So I'm looking for a generic way to "convert" as many non-ascii characters as possible before falling back to simply strip them out.