Take the 2-minute tour ×

I am trying to convert characters like:

ë, ä, ï, ö, etc.

To normal characters like:

e, a, i, o, etc.

What is the best way to do this? I've tried many things, like preg_replace and str_replace.

Can someone help me out?

-- EDIT --

What I tried, was:

$ts = array("[À-Å]","Æ","Ç","[È-Ë]","/[Ì-Ï]/","/Ð/","/Ñ/","/[Ò-ÖØ]/","/×/","/[Ù-Ü]/","/[Ý-ß]/","/[à-å]/","/æ/","/ç/","/[è-ë]/","/[ì-ï]/","/ð/","/ñ/","/[ò-öø]/","/÷/","/[ù-ü]/","/[ý-ÿ]/");

$tn = array("A","AE","C","E","I","D","N","O","X","U","Y","a","ae","c","e","i","d","n","o","x","u","y");

$title = preg_replace($ts, $tn, $text);
share|improve this question
possible duplicate of PHP Transliteration –  Quentin Mar 15 '12 at 13:31
You didn't show what you tried :( –  Evert Mar 15 '12 at 13:33
The correct term here would be accented characters. Special characters are things like $#@/\ etc. –  lgaud Mar 15 '12 at 13:53

2 Answers 2

up vote 5 down vote accepted

try this .. works for me.

iconv('utf-8', 'ascii//TRANSLIT', $text);
share|improve this answer
I tried utf-8 instead of utf8, and that worked! Thanks! –  Mossawi Mar 15 '12 at 13:59
utf8 and utf-8 didn't work for me. chars get replaced by a question mark, that's all. –  CREE7EN May 14 at 14:48

i like stewies' answer, but for completeness this works for me.

preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities($foo));
share|improve this answer

Your Answer


