Re: how to convet unicode to big5 chinese char in perl

[email protected] (David Graff)
Newsgroups perl.unicode
Message-ID <[email protected]>
[email protected] said:
> I got the unicode of the chinese char, like \x{4E2D}or &#20013; and I
> world like to print in dos. But I find in chinese dos I only can use the
> big5 code to print out the chinese char. Like print "\x{A4}\x{A4}" how
> can I encode the 4e2d to a4a4, I try to use encode(big5 $string) but it
> not work. 

"big5" might not be the right name for the encoding that you want.  On my 
system (freebsd, perl 5.8.7), the choices for big5 Chinese are:

 big5-eten
 big5-hkscs

(there's also euc-cn, gb2312-raw, gb12345-raw and cp936, but if I recall 
right, these are all GB-based).

If you were to show us a brief piece of code that you've tried, we would be
able to point directly to what you did wrong.  For example, here is a small
piece of code that will run as-is, and should produce the result you are
looking for.  (If it doesn't, try putting different character-set names
inside the single-quotes.)


use Encode;

$utf8char = "\x{4e2d}";
$doschar = encode( 'big5-eten', $utf8char );

print "\n $doschar\n";
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.