I want to convert unicode characters in user names to us-ascii. I.e my first name is Søren and my last name is Sjøstrøm. It should be converted to soren.sjostrom (unix style) as the user name. How do I do that?


If you only want to transliterate non-ASCII European characters (like those used in Nordic, German and French names), you can use the PHP function strtr. E.g:

$name = strtr($name,

If you want to do romanization of a wider range of non-ASCII alphabets (cyrillic, greek, etc.) take a look at the contributed project Transliteration.

While this is specifically to transliterate file names to US-ASCII, at its core is UTF-8 normalization (based on UtfNormal.php from MediaWiki) and transliteration (based upon Sean M. Burke's Text::Unidecode). You should be able to use the same libraries for romanization of names and other strings.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.