note 56531 deleted from function.htmlentities by nlopess
| From: | nlopess@php.net | Date: | Tue, 06 Sep 2005 14:48:39 +0000 |
| Subject: | note 56531 deleted from function.htmlentities by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94814@lists.php.net to get a copy of this message | ||
Note Submitter: jamal dot soueidan at gmail dot com
----
I had to use this to search in the MySQL database for the right arabic word.
This code convert all the أ etc. to arabic letters so its easier to search for words in
MySQL (tables).
I think PHP.NET changed the arabic letters to some unknown now ?
<?php
# By: Jamal Soueidan
# Date: 09/06/2005
# URL: http://www.arabfilms.org
function convertToArabic($text)
{
$text = str_replace("أ", "Ã", $text);
$text = str_replace("ؤ", "Ä", $text);
$text = str_replace("إ", "Å", $text);
$text = str_replace("ئ", "Æ", $text);
$text = str_replace("ا", "Ç", $text);
$text = str_replace("ب", "È", $text);
$text = str_replace("ة", "É", $text);
$text = str_replace("ت", "Ê", $text);
$text = str_replace("ث", "Ë", $text);
$text = str_replace("ج", "Ì", $text);
$text = str_replace("ح", "Í", $text);
$text = str_replace("خ", "Î", $text);
$text = str_replace("د", "Ï", $text);
$text = str_replace("ذ", "Ð", $text);
$text = str_replace("ر", "Ñ", $text);
$text = str_replace("ز", "Ò", $text);
$text = str_replace("س", "Ó", $text);
$text = str_replace("ش", "Ô", $text);
$text = str_replace("ص", "Õ", $text);
$text = str_replace("ض", "Ö", $text);
$text = str_replace("ط", "Ø", $text);
$text = str_replace("ظ", "Ù", $text);
$text = str_replace("ع", "Ú", $text);
$text = str_replace("غ", "Û", $text);
# 1595-1599 is just empty
$text = str_replace("ـ", "Ü", $text);
$text = str_replace("ف", "Ý", $text);
$text = str_replace("ق", "Þ", $text);
$text = str_replace("ك", "ß", $text);
$text = str_replace("ل", "á", $text);
$text = str_replace("م", "ã", $text);
$text = str_replace("ن", "ä", $text);
$text = str_replace("ه", "å", $text);
$text = str_replace("و", "æ", $text);
$text = str_replace("ى", "ì", $text);
$text = str_replace("ي", "í", $text);
$text = str_replace("ً", "ð ", $text);
$text = str_replace("ٌ", "ñ ", $text);
$text = str_replace("ٍ", "ò ", $text);
$text = str_replace("َ", "ó", $text);
$text = str_replace("ُ", "õ", $text);
$text = str_replace("ِ", "ö", $text);
$text = str_replace(""", "", $text);
$text = str_replace("'", "", $text);
return $text;
}
?>