Bug#342487: perl: Encode bug: decode destroys the string.

Niko Tyni ntyni at debian.org
Fri Apr 3 19:30:00 UTC 2009


forwarded 342487 http://rt.cpan.org/Public/Bug/Display.html?id=23876
notfound 342487 5.10.0-8
close 342487 5.10.0-1
thanks

On Wed, Dec 07, 2005 at 11:50:18PM +0100, Vincent Lefevre wrote:
> Package: perl
> Version: 5.8.7-7
> Severity: normal
 
> #!/usr/bin/env perl
> use strict;
> use Encode;
> my $it = "string";
> print "[$it]\n";
> print "[".decode("iso-8859-1", $it, 1)."]\n";
> print "[$it]\n";
> 
> produces the following output:
> 
> [string]
> [string]
> []
> 
> This is a regression. In the past, this was working.

As of Encode-2.20 (Perl 5.9.5), the documentation contains this:

 Encode::LEAVE_SRC
  If the "Encode::LEAVE_SRC" bit is not set, but CHECK is, then the
  second argument to "encode()" or "decode()" may be assigned to by the
  functions. If you’re not interested in this, then bitwise-or the
  bitmask with it.

See http://rt.cpan.org/Public/Bug/Display.html?id=23876

Indeed, 'decode("iso-8859-1", $it, 1 | Encode::LEAVE_SRC)' doesn't
modify $it.

Nothing else to fix, so I'm closing this at 5.10.0-1.
-- 
Niko Tyni   ntyni at debian.org






More information about the Perl-maintainers mailing list