Posted By

prf_q on 11/18/06


Tagged

english turkish iso-8859-9 turk tr2en turkish2english


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

skywalker
o0110o


Turkish Characters To English Alphabet Function


 / Published in: PHP
 

This script converts characters of Turkish alphabet into English(Latin). You can use it for AJAX too.

  1. <?
  2.  
  3. // FUNCTION by.AHMET ALP BALKAN (prf_Q)
  4. // www.ahmetalpbalkan.com 18.11.2006
  5.  
  6. // This function converts characters of Turkish alphabet into English(Latin). You can use it for AJAX too.
  7.  
  8. function turkishreplace($sData){
  9.  
  10. $newphrase=$sData;
  11. $newphrase = str_replace("Ü","U",$newphrase);
  12. $newphrase = str_replace("Ş","S",$newphrase);
  13. $newphrase = str_replace("Ğ","G",$newphrase);
  14. $newphrase = str_replace("Ç","C",$newphrase);
  15. $newphrase = str_replace("Ä°","I",$newphrase);
  16. $newphrase = str_replace("Ö","O",$newphrase);
  17. $newphrase = str_replace("ü","u",$newphrase);
  18. $newphrase = str_replace("ÅŸ","s",$newphrase);
  19. $newphrase = str_replace("ç","c",$newphrase);
  20. $newphrase = str_replace("ı","i",$newphrase);
  21. $newphrase = str_replace("ö","o",$newphrase);
  22. $newphrase = str_replace("ÄŸ","g",$newphrase);
  23.  
  24. $newphrase = str_replace("Ü","U;",$newphrase);
  25. $newphrase = str_replace("Ş","S",$newphrase);
  26. $newphrase = str_replace("Ğ","G",$newphrase);
  27. $newphrase = str_replace("Ç","C",$newphrase);
  28. $newphrase = str_replace("İ","I",$newphrase);
  29. $newphrase = str_replace("Ö","O",$newphrase);
  30. $newphrase = str_replace("ü","u",$newphrase);
  31. $newphrase = str_replace("ş","s",$newphrase);
  32. $newphrase = str_replace("ç","c",$newphrase);
  33. $newphrase = str_replace("ı","i",$newphrase);
  34. $newphrase = str_replace("ö","o",$newphrase);
  35. $newphrase = str_replace("ğ","g",$newphrase);
  36.  
  37. $newphrase = str_replace("%u015F","s",$newphrase);
  38. $newphrase = str_replace("%E7","c",$newphrase);
  39. $newphrase = str_replace("%FC","u",$newphrase);
  40. $newphrase = str_replace("%u0131","i",$newphrase);
  41. $newphrase = str_replace("%F6","o",$newphrase);
  42. $newphrase = str_replace("%u015E","S",$newphrase);
  43. $newphrase = str_replace("%C7","C",$newphrase);
  44. $newphrase = str_replace("%DC","U",$newphrase);
  45. $newphrase = str_replace("%D6","O",$newphrase);
  46. $newphrase = str_replace("%u0130","I",$newphrase);
  47. $newphrase = str_replace("%u011F","g",$newphrase);
  48. $newphrase = str_replace("%u011E","G",$newphrase);
  49.  
  50. return $newphrase;
  51. }
  52. ?>

Report this snippet  

You need to login to post a comment.