[pLog-svn] r5062 - plog/branches/lifetype-1.2/class/data
Jon Daley
plogworld at jon.limedaley.com
Mon Mar 12 09:18:54 EDT 2007
I thought this might have been my original change, so I looked it up.
HTML_ENTITES breaks something in the CJK environment? Is there a way we
can get this function to translate HTML_ENTITIES without breaking CJK? We
need to convert more than just SPECIAL_CHARS and the single quote.
----------------------------------------------------
r4591 | jondaley | 2007-01-27 10:55:28 -0500 (Sat, 27 Jan 2007) | 1 line
I think this function wasn't doing what people thought it was. It now
translates all html entities (most notable ), instead of just a
handful.
----------------------------------------------------
function htmlDecode( $htmlString, $quote_style = ENT_QUOTES ){
- $trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style));
- $trans_table['''] = "'";
- return( strtr( $htmlString, $trans_table ));
+ // replace numeric entities
+ $htmlString = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $htmlString);
+ $htmlString = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $htmlString);
+ // replace literal entities
+ $trans_tbl = get_html_translation_table(HTML_ENTITIES);
+ $trans_tbl = array_flip($trans_tbl);
+ return strtr($htmlString, $trans_tbl);
----------------------------------------------------
On Mon, 12 Mar 2007, Oscar Renalias wrote:
> Did you find the reason why and who made this change? It would be
> worth checking before reverting the changes...
>> - $trans_tbl = get_html_translation_table(HTML_ENTITIES);
>> + $trans_tbl = get_html_translation_table( HTML_SPECIALCHARS, $quote_style );
>> + $trans_tbl['''] = "'";
More information about the pLog-svn
mailing list