Re: strange problems with get_html_translation_table(HTML_ENTITIES);

From: Date: Wed, 23 Jan 2002 13:13:16 +0000
Subject: Re: strange problems with get_html_translation_table(HTML_ENTITIES);
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-81678@lists.php.net to get a copy of this message
At 11:46 AM 1/23/2002 +0100, Rein Velt wrote:
<? $trans=get_html_translation_table(HTML_ENTITIES); print_r($trans); ?> This is the output Array ( [ ] => [¡] => ¡ [¢] => ¢ [£] => £ [¤] => ¤ [¥] => ¥ [¦] => ¦ [§] [...]
It should return an array where X != $trans[X] Something like this: Array ( [ ] =>&nbsp; [¡] => &blah1; [¢] => &blah2; [£] => &blah3; [¤] => ......
Are you echoing this output to the browser? If so, then it probably IS printing what it's supposed to, but the browser is converting the htmlentities as it displays them. Either view the source code of the page to see if it's working properly, or do the following to see what you are expecting: <? $trans=get_html_translation_table(HTML_ENTITIES); ob_start(); print_r($trans); $tableoutput = ob_get_contents(); $tableoutput = htmlentities($tableoutput); ob_end_clean(); echo "<pre>".$tableoutput."</pre>"; ?> This turns on output buffering, which causes the output of print_r() to be stored in an internal buffer instead of actually displayed. Then the buffer's contents are stored in a variable and htmlentities() are performed on them. The <pre> tags are so you can see the line breaks and spaces on the browser exactly the way they appear in the source... HTH...

« previous php.general (#81678) next »