perl-unicode

converting Japanese chars into their Unicode values using 5.8's Encode

2002-09-19 01:30:04
Hello,

I want to convert source code written in the Japanese shift_jis
character set, into their Unicode numbers. For instance, "ŒŸ" should
result in "U+691C" (which is 26908 in decimal). I tried using the
Encode module of Perl 5.8 with something like this:

        use Encode::JP;
        my $string = "ŒŸ";
        Encode::from_to($string, "shiftjis", "utf8");
        my $ord = join("\n", unpack('U*', $string));
        print "$string\n$ord";

But, this gives a 3-character string "怜" (with the decimal values
230, 164 and 156). Could anyone please point me to the right direction
on how to get the decimal number 26908 instead?

Thanks in advance.

--
rob.