note 9375 deleted from function.htmlentities by jimw

From: Date: Mon, 17 Dec 2001 22:28:11 +0000
Subject: note 9375 deleted from function.htmlentities by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23015@lists.php.net to get a copy of this message
Hey, this is a working piece of code. Hope it helps everyone trying to convert a special char string like words in spanish (or any other lang) to a readable string in wml. the mini browser of your cell-phone will not understand the special characters till they have been properly converted. heres how to do it... enjoy.. <? header("Content-type: text/vnd.wap.wml"); header("Pragma: no-cache"); header("Cache-Control: no-cache, must revalidate"); echo('<?xml version="1.0"?>'); echo( "\n"); echo( '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">'); echo( "\n"); function literal2numeral(&$value, $key) { $value="?".ord($key).";"; } $trans=get_html_translation_table (HTML_ENTITIES); array_walk ($trans, 'literal2numeral'); reset($trans); function wmlencode($string) { GLOBAL $trans; return strtr($string,$trans); } ?> <wml> <card id="nilesh" title="nilesh"> <p align="left"> <b>WML-TEST</b> </p> <p align="left"> <? $mystring = wmlencode("Sinfonía de colores,SANTIAGO.- Jóvenes egresados de la Facultad de Humanidades"); echo $mystring; ?> </p> </card> </wml>

« previous php.notes (#23015) next »