php function to remove accented (unallowable) url characters

by Prakash 2013-07-01 16:43:27

The following is a php function which removes the non allowable characters in a string.

//function to clean accentented characters to get clean string
function replaceAccentedCharacters($input)
{
$accent='ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËéèêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ:';
$noaccent='AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn-';
$cleaned = strtr($input, $accent, $noaccent);

return $cleaned;
}
//function end


Use it as follows :


$string = 'Åàgra';
echo replaceAccentedCharacters($string); //prints 'Aagra'
853
like
0
dislike
0
mail
flag

You must LOGIN to add comments