Convert Special Characters (other language) to English in PHP
Is there a function that coverts sp开发者_如何学Pythonecial characters to their english equivalents. For Eg. Convert é to e. Etc...
The function you are after is iconv() - from the user notes, this seems to be what you want to do: characters transliteration
You should use this one and it will works:
setlocale(LC_CTYPE, 'nl_BE.utf8');
$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
I've tested it a lot of accentuated characters
If you don't like danp's solution (iconv), you could use strtr
with a list of conversions. This page has a sample script (first Google result).
You could make a function holding a array of chars you want exchanged and pass strings through and just change ã to a that way, if iconv() doesn´t work out for you.
精彩评论