develooper Front page | perl.perl5.porters | Postings from January 2004

Re: Bug in Encode/perlio

Thread Previous | Thread Next
From:
SADAHIRO Tomoyuki
Date:
January 24, 2004 22:55
Subject:
Re: Bug in Encode/perlio
Message ID:
20040125155343.66AD.BQW10602@nifty.com

On Mon, 8 Dec 2003 22:16:16 +0000
Matt Sergeant <matt@sergeant.org> wrote:

> There's a rather nasty bug in perlio with some japanese files I'm 
> trying to read. They are decoded from spams. When trying to read the 
> files, perl hangs while doing <$fh>.
> 
> I suspect they are corrupt or broken (ISO-2022-JP) files, but still, 
> perl shouldn't hang.
> 
> I'm not sure if this is a bug in Encode (probably - since upgrading 
> Encode fixed one of the files) or perlio.
> 
> There's an example file attached to this bug in RT: 
> https://rt.cpan.org/NoAuth/Bug.html?id=4602

Your file is encoded in Shift-JIS.

\>perl -e "print chr 0x41" | perl -Mencoding=iso-2022-jp -e "print <>"
A
\>perl -e "print chr 0x80" | perl -Mencoding=iso-2022-jp -e "print <>"

#...infinite loop... I must terminate the process myself.


In contrast to Encode::JP::JIS7, Encode::XS works fine:
\>perl -e "print chr 0x41" | perl -Mencoding=euc-jp -e "print <>"
A
\>perl -e "print chr 0xFF" | perl -Mencoding=euc-jp -e "print <>"
euc-jp "\xFF" does not map to Unicode at -e line 1.
\xFF

Regards,
SADAHIRO Tomoyuki


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About