Encode::decode() clears scalar being decoded?

R

Robert Urban

if I run the following script:

-snip-
#!/usr/bin/perl

use Encode qw/decode/;

my $string = "B\303\266rsen Feiertag";
print "string=[$string]\n";

my $tmp = decode('utf8', $string, 1);
print "string=[$string], tmp=[$tmp]\n";
-snip-

I get the following output:

-snip-
string=[Börsen Feiertag]
string=[], tmp=[B?sen Feiertag]
-snip-


What happened to $string? There is no mention of side-effects in the Encode
manpage... This only happens when CHECK is set to 1.

cheers,

Rob Urban
 
B

Ben Bullock

if I run the following script:

-snip-
#!/usr/bin/perl

use Encode qw/decode/;

my $string = "B\303\266rsen Feiertag";
print "string=[$string]\n";

my $tmp = decode('utf8', $string, 1);
print "string=[$string], tmp=[$tmp]\n";
-snip-

I get the following output:

-snip-
string=[Börsen Feiertag]
string=[], tmp=[B?sen Feiertag]
-snip-

I get the same result.

I think it's a bug in Encode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top