How would I go about converting foreign characters to english characters?
Asked
Active
Viewed 2,201 times
-1
-
Please add some more detail and examples. What is a "foreign character"? โ Pekka Dec 25 '10 at 18:49
-
1possible duplicate of [Remove accents without using iconv](http://stackoverflow.com/questions/3542818/remove-accents-without-using-iconv) โ ajreal Dec 25 '10 at 18:49
-
http://stackoverflow.com/questions/1284535/php-transliteration โ Rosh Oxymoron Dec 25 '10 at 20:04
3 Answers
2
Mapping them:
$map = array(
'รก' => 'a',
'e' => 'e',
// ...
);
$text = str_replace(array_keys($map), array_values($map), $text);

ssice
- 3,564
- 1
- 26
- 44
2
PHP has strtr() that can achieve this. Read more here
The first entry under User Contributed Notes has something that should help you

Community
- 1
- 1

Chris Ghenea
- 12,473
- 1
- 29
- 36
0
create an character mapping array with element format: foreign characters => english characters
and replace string with all array element.

erinus
- 734
- 4
- 5