How to remove accents and turn letters into "plain" ASCII characters?

Mark Lalor picture Mark Lalor · Aug 22, 2010 · Viewed 62.9k times · Source

What is the most efficient way to remove accents from a string e.g. ÈâuÑ becomes Eaun?

Is there a simple, built in way that I'm missing or a regular expression?

Answer

Piskvor left the building picture Piskvor left the building · Aug 22, 2010

If you have iconv installed, try this (the example assumes your input string is in UTF-8):

echo iconv('UTF-8', 'ASCII//TRANSLIT', $string);

(iconv is a library to convert between all kinds of encodings; it's efficient and included with many PHP distributions by default. Most of all, it's definitely easier and more error-proof than trying to roll your own solution (did you know that there's a "Latin letter N with a curl"? Me neither.))