Code

Convert Foreign Characters in PHP

I couldn't find a built in function to convert foreign characters, but was able to construct the following, which seems to be working well. Hopefully it will save you some time.


function convertForeignCharacters($string) {
    $find = "àèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸåÅøØ" ;
    $replace = "aeiouAEIOUaeiouyAEIOUYaeiouAEIOUanoANOaeiouyAEIOUYaAoO" ;
    $output = strtr($string,$find,$replace);
    return $output;
    }

Copyright © 2010, Ink Plant. All rights reserved.