Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Encode::decode() clears scalar being decoded?

Reply
Thread Tools

Encode::decode() clears scalar being decoded?

 
 
Robert Urban
Guest
Posts: n/a
 
      04-23-2009

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
 
Reply With Quote
 
 
 
 
Ben Bullock
Guest
Posts: n/a
 
      04-23-2009
On Thu, 23 Apr 2009 02:05:14 +0200, Robert Urban wrote:

> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Encode::decode() clears scalar being decoded? Robert Urban Perl Misc 10 04-24-2009 01:24 AM
Replace scalar in another scalar Mark Perl Misc 4 01-27-2005 02:48 PM
window.open clears parent window KenG ASP .Net 4 02-17-2004 05:24 PM
stop plus (+) symbol within scalar variable being interpolated in RE when followed by a number Tom Perl Misc 6 12-16-2003 12:33 PM
Shorthand for($scalar) loops and resetting pos($scalar) Clint Olsen Perl Misc 6 11-13-2003 12:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57