Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Special Characters (other language) to English in PHP

Tags:

php

character

Is there a function that coverts special characters to their english equivalents. For Eg. Convert é to e. Etc...

like image 607
castor Avatar asked Mar 02 '10 09:03

castor


2 Answers

The function you are after is iconv() - from the user notes, this seems to be what you want to do: characters transliteration

like image 197
dmp Avatar answered Oct 22 '22 11:10

dmp


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

like image 4
Tanuljjatszva Avatar answered Oct 22 '22 09:10

Tanuljjatszva