note 8667 added to htmlentities
| From: | Federico at Pomi dot net | Date: | Sat, 23 Sep 2000 01:23:05 +0000 |
| Subject: | note 8667 added to htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5445@lists.php.net to get a copy of this message | ||
With WML there are just few literal entities (7 AFAIR). All the "strange" letters that
have an html entity must be written with the ascii value. If you want to wmlencode a string, use the
following code. It will first create a conversion table based on the HTMLEntities table, but instead
of using literal entities, it replace the char with its ascii value.
Example: "è" would become è with html entities. With the function wmlencode()
below, it's translated to &232; which works on WAP phones and standard browsers as well.
function literal2numeral(&$value, $key) {$value="&#".ord($key).";";}
$trans=get_html_translation_table (HTML_ENTITIES);
array_walk ($trans, 'literal2numeral');
function wmlencode($string)
{
GLOBAL $trans;
return strtr($string,$trans);
}
http://www.php.net/manual/function.htmlentities.php