For some reason (it's a long story) I need to change the accents with their 'normal' counterparts.
I'm doing this:
$array = array(
'ò' => 'o',
'ó' => 'o',
'à' => 'a',
'è' => 'e',
'é' => 'e',
'ù' => 'u',
);
return str_replace(array_keys($array), array_values($array), $string);
but it doesn't work (with normal letter works like a charm) I think it's an encoding problem, is there another way to do this? How can I fix this?
Thank you.
as simple as
From URL Friendly Username in PHP? and slightly modified
strtr is used to translate certain characters. Here is an example from the comments:
unfortunately you do still need to list any character translations. This, from the comments, seems to be pretty complete.