This program assumes nothing about encoding, it is processing raw bytes. karl williamson via RT <perlbug-followup@perl.org>编写: >On 07/03/2014 07:23 PM, James E Keenan via RT wrote: >> On Sun Mar 16 00:41:07 2014, ntysdd@gmail.com wrote: >>> Reply-To: ntysdd@gmail.com >>> Subject: can't read pinyin characters from terminal >>> To: perlbug@perl.org >>> Message-Id: <5.18.2_3700_1394954556@aaa-PC> >>> From: ntysdd@gmail.com >>> >>> >>> This is a bug report for perl from ntysdd@gmail.com, >>> generated with the help of perlbug 1.39 running under perl 5.18.2. >>> >>> >>> ----------------------------------------------------------------- >>> [Please describe your issue here] >>> Using strawberryperl portable under a simplified Chinese env.(CP936) >>> Found perl can't read pinyin chars properly from a terminal. >>>> > >> >> >>> Example: >>>> perl -ne "print" >>>> nǐtàiyánsù >>> n t iy ns >>> >>> Chinese characters are OK. >>> Reading from a file using redirection is also OK. >>> Only terminal plus pinyin will get wrong. >>> >> >> Can anyone familiar with CP936 reproduce this? >> > >I'm trying to understand this report. I am not familiar with CP936, but >I looked it up, and it is a one and two byte encoding. Perl supports >internally only single byte encodings, plus, starting in 5.20, UTF-8. >So this encoding shouldn't be expected to work in Perl. What one is >supposed to do is to use the Encode module to translate the encoding >into Perl's internal form on input, and transform back on output. An >example I found is http://www.perlmonks.org/?node_id=537416 > >Thread Next