You are here: Re: [PHP] html_entity_decode () for …, ’, etc. « PHP « IT news, forums, messages
Re: [PHP] html_entity_decode () for …, ’, etc.

Posted by Leon Vismer on 08/10/05 23:21

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;

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация