I've been reading a few other questions but I am still stuck on the problem of converting strings containing accented characters into plain characters (by which I mean a-z)
I have a product name "Áhkká" which is already encoded as "Áhkká"
I want to decode this to the string with accents, and then convert it to read "Ahkka"
So far, I have tried:
function convert($name) {
$name = html_entity_decode($name,ENT_COMPAT,"UTF-8");
$name = iconv('UTF-8', 'ASCII//TRANSLIT', $name);
return $name;
}
I get an error from iconv: "Detected an illegal character in input string"
I have also tried using htmlspecialchars_decode($name); but that gives me �hkk�
I also found a string replace function to clear accents, but I can't seem to pass a non-html string to it
$name = strtr($name,'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ','aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
Can someone please offer a solution? The server is running PHP 5.2.13. iconv is enabled glibc 2.5 (input/internal/output encoding is ISO-8859-1 in phpinfo)