note 8667 deleted from function.htmlentities by jimw
| From: | jimw@php.net | Date: | Mon, 17 Dec 2001 22:27:45 +0000 |
| Subject: | note 8667 deleted from function.htmlentities by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23012@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);
}