Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 45602
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: Nobody in particular
Requestors: g.zumstrull [...] rheinenergie.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: decode deletes input data when CHECK = Encode::FB_CROAK
Date: Thu, 30 Apr 2009 18:17:02 +0200
To: <bug-Encode [...] rt.cpan.org>
From: <g.zumstrull [...] rheinenergie.com>
After calling decode(ENCODING, $octets, Encode::FB_CROAK) the string $octets is the empty string. This doesn't happen with other CHECKs but FB_CROAK. Show quoted text
> # Example 1: FB_PERLQQ, prints blabla as expected > perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets, Encode::FB_PERLQQ); print "$octets\n";'
blabla Show quoted text
> # Example 2: wrong UTF-8, FB_CROAK, dies as expected > perl -e 'use Encode; my $octets = "bläblä"; decode("utf8", $octets, Encode::FB_CROAK); print "$octets\n";'
utf8 "\xE4" does not map to Unicode at /usr/lib/perl5/5.10/i686-cygwin/Encode.pm line 163. Show quoted text
> # Example 3: UTF-8 ok, FB_CROAK, prints empty line => wrong > perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets, Encode::FB_CROAK); print "$octets\n";'
Show quoted text
> perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets, Encode::FB_CROAK); print (defined $octets? "yes\n": "no\n");'
yes Show quoted text
> perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets, Encode::FB_CROAK); print ($octets eq ""? "yes\n": "no\n");'
yes Encode-2.25 Perl 5.10 CYGWIN_NT-5.1 sys-15192 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
That's a correct behavior. When it croaks $octet is set to where Encode fails to stop. Try Encode::LEAVE_SRC instead. Dan the Encode Maintainer On Thu Apr 30 12:17:28 2009, g.zumstrull@rheinenergie.com wrote: Show quoted text
> After calling decode(ENCODING, $octets, Encode::FB_CROAK) the string > $octets is the empty string. This doesn't happen with other CHECKs but > FB_CROAK. >
> > # Example 1: FB_PERLQQ, prints blabla as expected > > perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets,
> Encode::FB_PERLQQ); print "$octets\n";' > blabla >
> > # Example 2: wrong UTF-8, FB_CROAK, dies as expected > > perl -e 'use Encode; my $octets = "bläblä"; decode("utf8", $octets,
> Encode::FB_CROAK); print "$octets\n";' > utf8 "\xE4" does not map to Unicode at /usr/lib/perl5/5.10/i686- > cygwin/Encode.pm line 163. >
> > # Example 3: UTF-8 ok, FB_CROAK, prints empty line => wrong > > perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets,
> Encode::FB_CROAK); print "$octets\n";' >
> > perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets,
> Encode::FB_CROAK); print (defined $octets? "yes\n": "no\n");' > yes
> > perl -e 'use Encode; my $octets = "blabla"; decode("utf8", $octets,
> Encode::FB_CROAK); print ($octets eq ""? "yes\n": "no\n");' > yes > > Encode-2.25 > Perl 5.10 > CYGWIN_NT-5.1 sys-15192 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin