1

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.

cj333
  • 2,547
  • 20
  • 67
  • 110

2 Answers2

3

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.

Matti Virkkunen
  • 63,558
  • 9
  • 127
  • 159
  • do u know how to transfer punctuation mark use php? I also want to transfer `%20` to a `space`, transfer `%27` to `'`? Thank u. – cj333 Feb 02 '11 at 23:29
1

Have a look at How to change diacritic characters to non-diacritic ones

Community
  • 1
  • 1
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636