Good
I have a function that generates the name for friendly urls but I am having a problem that when the function generates the name if that name contains accents it does not put the same word but without accent it puts another character
Function
function url_amigavel($string) {
$palavra = strtr($string, "ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ", "SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
$palavranova = str_replace("_", " ", $palavra);
$pattern = '|[^a-zA-Z0-9\-]|'; $palavranova = preg_replace($pattern, ' ', $palavranova);
$string = str_replace(' ', '-', $palavranova);
$string = str_replace('---', '-', $string);
$string = str_replace('--', '-', $string);
return strtolower($string);
}
For example
César Sousa
Should convert to cesar-sousa But it is to convert like this c-sar-sousa