> > hello everyone:> > I'm using Perl to develop a web-site.
But you don't tell which version of Perl.
it's Perl 5.6.1.
If you get
ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT
then you can build a table to work with. The script below simply prints the two values, but you can build a hash to do what you want. In Perl 5.8+ most people would use the Encode module, I suppose.
#!/usr/bin/perl no warnings ; $f = "/Users/Shared/Downloads/CP936.TXT" ; # path to downloaded file $/ = /(\015\012|\015|\012)/ ? $1: "\n"; open F, $f or die $!; for (<F>) { unless(/^#/) { s~\t\#.+$~~; s~0x~~g ; s~^([0-9A-F][0-9A-F])\t~chr( hex $1) . "\t"~e ; s~^([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])~chr( hex $1) . chr(hex $2)~e ;
s~\t([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])~"\t" . chr(hex $1) . chr(hex $2)~e ;
}
}
> >From this website http://rf.net/~james/perli18n.html (the first site Googlefinds for unicode perl web) I see that different versions of Perl have different levels of support for Unicode.
I just want to know how to convert the encode method.
Such as:
"�����l�B" is a sentence in GBK code.
(1)how to convert it into unicode?
(2)and how to convert it back?
(3)if the user's OS is Japanese , how to convert the unicode message into Shift-JIS
as "�����l"?
Thanks a lot!

