So, this is the problem, i think everything is ok with this function, but URLs like:
reparações
are showing always as "reparaa-a-es".
The expected result should be "reparacoes"
EDIT:
So, the solution was simple, it seems php has a native function that does what i need:
rawurlencode ( string $str )
function generateSafeUrls($url = '') {
## normalize accented characters
$url = strtr($url, "\xA1\xAA\xBA\xBF\xC0\xC1\xC2\xC3\xC5\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD\xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8\xF9\xFA\xFB\xFD\xFF", "_ao_AAAAACEEEEIIIIDNOOOOOUUUYaaaaaceeeeiiiidnooooouuuyy");
## make sure its only english and dashes
$url3 = preg_replace("/[^A-Za-z0-9_-]+/", "_", $url);
## return safe url
return($url3);
}
What should be the problem?
Thanks guys.