I'm only guessing here, but if you have a Chinese-enabled version of ms-windows, it might be the case that the dos-prompt window uses cp936 (Extended GB) for Chinese characters, or whatever cp??? applies to Big5 (Traditional) Chinese, rather than using unicode.

For that matter, if the dos-prompt window is "unicode-enabled", you might need to use UTF-16LE rather than utf8. You'd have to see whether the so-called "Help" or alleged documentation for that OS can give you any guidance on whether the dos-prompt window supports Chinese characters at all, and if so, what specific encoding is expected.

Assuming it is possible, and you can find out what character set to use, Encode and PerlIO are your friends -- you can create a perl-internal utf8 string like this:

my $utf8 = join( "", map { chr() } ( 36127, 25285, 36807, 37325 ));
and then either use Encode::encode() to convert it to something besides utf8 (if necessary), or simply use  binmode STDOUT, ":encoding(cp936)"; (use alternate character encoding name as needed) so that perl converts the string into the expected character set on output (see perlunicode and perluniintro).

(If it turns out that the dos-prompt window wants utf8 data, just do  binmode STDOUT, ":utf8"; so that perl knows you want output utf8 data.)

(updated to fix missing close-paren in code snippet)


In reply to Re: help needed in unicode displaying by graff
in thread help needed in unicode displaying by uva

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.