Re: About HTML unicode

[email protected] (Gisle Aas)
Newsgroups perl.unicode
Message-ID <[email protected]>
"He Zhiqiang" <[email protected]> writes:

> Hi list: I've a problem to convert a unicode character into it's
> decimal or Hexadecimal value. The following URL:
> http://code.cside.com/3rdpage/us/unicode/converter.html
>  can easily convert via Javascript function escape(), but i wonder
> that is there some method or function
> or modules can do the same job??

I think encode_entities_numeric() from HTML::Entities will do.

>   If i can do it, then in one html
> page, i can display ont only chinese, but
> also japanese, korea etc... This is something like HTML unicode, am i
> right? The ord() function can't do the job because it return the
> incorrect decimal value. perhaps i do not describe
> this question clearly, and hope all can excuse me :)

You can format the result of ord() as hex using perl's sprintf()
function.

Regards,
Gisle
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.