develooper Front page | perl.perl5.porters | Postings from July 2014

回复: Re: [perl #121450] can't read pinyin character

Thread Next
July 4, 2014 08:06
回复: Re: [perl #121450] can't read pinyin character
Message ID:
This program assumes nothing about encoding, it is processing raw bytes.

karl williamson via RT <>编写:

>On 07/03/2014 07:23 PM, James E Keenan via RT wrote:
>> On Sun Mar 16 00:41:07 2014, wrote:
>>> Reply-To:
>>> Subject: can't read pinyin characters from terminal
>>> To:
>>> Message-Id: <5.18.2_3700_1394954556@aaa-PC>
>>> From:
>>> This is a bug report for perl from,
>>> 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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About