Skip to content

Instantly share code, notes, and snippets.

@mattclements
Created August 23, 2012 08:58
Show Gist options
  • Save mattclements/3434413 to your computer and use it in GitHub Desktop.
Save mattclements/3434413 to your computer and use it in GitHub Desktop.
Encoding New
function Unaccent($string)
{
return preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
}
echo Unaccent('ľľščťžýáíŕďňä'); // llsctzyairdna
echo Unaccent('Iñtërnâtiônàlizætiøn'); // Internationalizaetion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment