Re: html_entity_decode () for …, ’, etc.

From: Date: Wed, 10 Aug 2005 20:21:45 +0000
Subject: Re: html_entity_decode () for …, ’, etc.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220362@lists.php.net to get a copy of this message
Hi Marco To awnser you question I do not know why it is excluded from the default decode array. Maybe it could be that these are multibyte characters (any takers)? You can get a list of the entities that are changed $trans = get_html_translation_table(HTML_ENTITIES); echo"<pre>";print_r($trans);echo"</pre>"; to add some extras as you have below, use something similar to function htmldecode($string) { $trans = get_html_translation_table(HTML_ENTITIES); $trans[chr(0xe2).chr(0x80).chr(0xa6)] = '&hellip;'; $trans = array_flip($trans); return strtr($string, $trans); } $string = "&hellip;&amp;"; echo htmldecode($string) ."\n"; Note: obviously hex e2 80 a6 make up the hellip chars. Hope this helps Cheers -- Leon On Wednesday 10 August 2005 20:55, Marco wrote: > I tried using html_entity_decode () but why won't these characters decode: > > &rsquo; > &ndash; > &hellip; > &ldquo; > &rdquo;

« previous php.general (#220362) next »