develooper Front page | perl.unicode | Postings from June 2006

Encode::decode_utf8 and references

Thread Next
From:
Sam Tregar
Date:
June 18, 2006 00:33
Subject:
Encode::decode_utf8 and references
Message ID:
Pine.LNX.4.62.0606171223480.18214@hillmont.dreamhost.com
Hello all.  I'm maintaining a Perl app which relies on a possibly
incorrect behavior in Encode::decode_utf8 - references are expected to
pass through unmangled.  This worked fine until a recent upgrade.
Observe Encode v2.08 with Perl v5.6.1:

   $ perl -MEncode -MData::Dumper -e \
       'my $ref = Encode::decode_utf8({ foo => 1}); print Dumper($ref);'
   $VAR1 = {
             'foo' => 1
           };

However, Encode v2.18 with Perl v5.6.1 is not so forgiving:

   $ perl -MEncode -MData::Dumper -e \
       'my $ref = Encode::decode_utf8({ foo => 1}); print Dumper($ref);'
   $VAR1 = 'HASH(0x9932180)';

So, is this a bug in Encode or a bug in my app?  I'm leaning towards
the latter but I thought I'd check with you before I started trying
to fix it (no tests, argh!).  Aside from "don't do that", can you
suggest a fix?

Thanks,
-sam

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