in reply to Re: unicode strings without decoding or warnings or corruption
in thread unicode strings without decoding or warnings or corruption

How is your code a solution, given the stated (and weird) restriction of

I do not want to iterate over my huge hash of hashes to Encode::decode('UTF-8')

While I don't doubt its correctness, if you are really the same person as the original poster, can you maybe explain how your approach of using Data::Visitor is not iterating over your hash?

Replies are listed 'Best First'.
Re^3: unicode strings without decoding or warnings or corruption
by Anonymous Monk on May 13, 2012 at 11:46 UTC

    How is your code a solution, given the stated (and weird) restriction of

    I looked through my stuff and found that snippet to iterate over an arbitrary structure -- I thought I would have to write something from scratch

      OK--you lost me there. Why can't you use decode? Using your first snippet, I got:
      #!/usr/bin/perl use strict; use warnings; use Encode; require Encode::Detect; my $data = "Foo \xE2\x80\x94 Bar"; my $utf8 = decode("Detect", $data); binmode STDOUT, ":encoding(UTF-8)"; print $utf8;
      What's lame about that?

        OK--you lost me there...

        Lost you? Try reading what I posted, stuff like like "large data structure" and "I thought I would have to write something from scratch "