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

Posted by Chung Leong on 12/17/66 11:51

ngocviet wrote:
> I want to convert it to UTF-8 encoding
>
>
> Chung Leong wrote:
> > ngocviet wrote:
> > > I have a text like this: "Thuyền Và Biển"
> > > How to convert it to: "Thuyền Và Biển"
> > > Please help!
> >
> > What text char-set/encoding do you want the text to be?

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.

 

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

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