is there a way to transfer Latin letters to english letters with php?
Such as: āáǎà
transfer to a
,
ēéěè
transfer to e
,
īíǐì
transfer to i
,
... // there may be dozens which are main in Germany, French, Italian, Spain...
PS: how to transfer punctuation mark use php? I also want to transfer %20
to a space, transfer %27
to '
. Thank u.
iconv can usually do this for you:
iconv("utf-8", "ascii//TRANSLIT//IGNORE", $string);
Adjust source encoding to preference. The //TRANSLIT//IGNORE
part tells iconv to transliterate (replace with "similar" characters) whatever it can and ignore (leave out or replace with "?", can't remember) what it can't.
Have a look at How to change diacritic characters to non-diacritic ones