Posted by Kimmo Laine on 06/30/06 11:12
"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:1151591566.326139.249300@y41g2000cwy.googlegroups.com...
>
> You will have to do it manually using preg_replace_callback(), as I
> don't believe html_entity_decode() is capable of decoding such
> entities. Here're the basics:
>
> $text = preg_replace_callback('/&#(d+);/',
> 'numeric_html_entity_replace', $text);
>
> function numeric_html_entity_replace($m) {
> $unicode = (int) $m[1];
> $utf8 = /* encode the Uncode value */
> return $utf8
> }
>
> The tricky part is converting the Unicode value to a UTF-8 string.
There's a solution for that at php.net
http://fi.php.net/manual/en/function.chr.php#55978
chr seems to be ASCII-only (which is kinda stupid if you think about it,
plenty of utf implementations these days) but "grey" had written a
workaround for it.
--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|