You are here: Re: Convert text « PHP Programming Language « IT news, forums, messages
Re: Convert text

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)

 

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

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