Quoth [EMAIL PROTECTED] (He Zhiqiang):
> 
>  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?? 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? 

I routinely use

use Encode qw/:fallbacks/;
use PerlIO::encoding ();

$PerlIO::encoding::fallback = FB_XMLCREF; # could use HTMLCREF instead
binmode STDOUT, ':encoding(ascii)';

which will cause all non-ascii characters in the output to be converted
to HTML's ༀ form. You need 5.8 for this to work, but you need 5.8
for Unicode support anyway.

(if this is wrong, could someone tell me where, and why... ? :)

>  The ord() function can't do the job because it return the incorrect decimal 

I presume you mean 'the ord function returns the decimal value, which is
not what I want (I want the hex value)' rather than 'the ord function
returns an incorrect decimal value (i.e. the value itself is wrong)'?

Ben

-- 
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks]         [EMAIL PROTECTED]

Reply via email to