note 56531 added to function.htmlentities

From: Date: Tue, 06 Sep 2005 13:04:38 +0000
Subject: note 56531 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-94811@lists.php.net to get a copy of this message
I had to use this to search in the MySQL database for the right arabic word. This code convert all the &#1571; 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("&#1571;", "Ã", $text); $text = str_replace("&#1572;", "Ä", $text); $text = str_replace("&#1573;", "Å", $text); $text = str_replace("&#1574;", "Æ", $text); $text = str_replace("&#1575;", "Ç", $text); $text = str_replace("&#1576;", "È", $text); $text = str_replace("&#1577;", "É", $text); $text = str_replace("&#1578;", "Ê", $text); $text = str_replace("&#1579;", "Ë", $text); $text = str_replace("&#1580;", "Ì", $text); $text = str_replace("&#1581;", "Í", $text); $text = str_replace("&#1582;", "Î", $text); $text = str_replace("&#1583;", "Ï", $text); $text = str_replace("&#1584;", "Ð", $text); $text = str_replace("&#1585;", "Ñ", $text); $text = str_replace("&#1586;", "Ò", $text); $text = str_replace("&#1587;", "Ó", $text); $text = str_replace("&#1588;", "Ô", $text); $text = str_replace("&#1589;", "Õ", $text); $text = str_replace("&#1590;", "Ö", $text); $text = str_replace("&#1591;", "Ø", $text); $text = str_replace("&#1592;", "Ù", $text); $text = str_replace("&#1593;", "Ú", $text); $text = str_replace("&#1594;", "Û", $text); # 1595-1599 is just empty $text = str_replace("&#1600;", "Ü", $text); $text = str_replace("&#1601;", "Ý", $text); $text = str_replace("&#1602;", "Þ", $text); $text = str_replace("&#1603;", "ß", $text); $text = str_replace("&#1604;", "á", $text); $text = str_replace("&#1605;", "ã", $text); $text = str_replace("&#1606;", "ä", $text); $text = str_replace("&#1607;", "å", $text); $text = str_replace("&#1608;", "æ", $text); $text = str_replace("&#1609;", "ì", $text); $text = str_replace("&#1610;", "í", $text); $text = str_replace("&#1611;", "ð ", $text); $text = str_replace("&#1612;", "ñ ", $text); $text = str_replace("&#1613;", "ò ", $text); $text = str_replace("&#1614;", "ó", $text); $text = str_replace("&#1615;", "õ", $text); $text = str_replace("&#1616;", "ö", $text); $text = str_replace("&quot;", "", $text); $text = str_replace("'", "", $text); return $text; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56531 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56531&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56531&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56531&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56531&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56531&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56531&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56531&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94811) next »