First I tried, utf8 encode-decode, failed, changed the file format from ASCII to UTF-8, tried again utf encode, changed the file format several times and failed.
Then I recognized "iconv", tried and failed. Changed the locale with "setlocale". I tried Turkish, English and other types, failed.
Finally, I wrote this function and I am pleased with the output :)
function transliterateTurkishChars($inputText) { $search = array('ç', 'Ç', 'ğ', 'Ğ', 'ı', 'İ', 'ö', 'Ö', 'ş', 'Ş', 'ü', 'Ü'); $replace = array('c', 'C', 'g', 'G', 'i', 'I', 'o', 'O', 's', 'S', 'u', 'U'); $outputText=str_replace($search, $replace, $inputText); return $outputText; } $goodText=transliterateTurkishChars($badText);
trante
source share