develooper Front page | perl.perl5.porters | Postings from September 2018

Re: [perl #132724] Program gets stuck when trying to read an illegaliso-2022-jp file

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
September 15, 2018 16:39
Subject:
Re: [perl #132724] Program gets stuck when trying to read an illegaliso-2022-jp file
Message ID:
CAHhgV8josqnKwyTkAsWs0m8vsTb9QiBtW5UQSQEx3hKynXQ7fw@mail.gmail.com
On Tue, Jan 16, 2018 at 7:56 AM Hiroshi Manabe
<perlbug-followup@perl.org> wrote:
> You can reproduce the bug with the following procedure:
> 1. perl -e 'print "\x8f";' > temp.txt
> 2. perl -e 'open my $in, "<:encoding(iso-2022-jp)", "temp.txt"; print <$in>;'

Given that this one-liner doesn't hang:
  perl -MEncode -e 'decode("iso-2022-jp", "\x8f", Encode::FB_CROAK |
Encode::LEAVE_SRC)'
I'm pretty sure the issue is in PerlIO::encoding, not in Encode. Which
means it's a bug on our side, not Encode's.

I assume "\x8f" is the start of a multi-byte character. :encoding
doesn't handle such errors at the end of a file well (I think there's
a already a ticket about this but I can't find it, though I'm sure
#84250 is related).

I think I know how to fix this though.

Leon

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