in reply to Re^2: 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 looked through my stuff and found that snippet to iterate over an arbitrary structure -- I thought I would have to write something from scratch

  • Comment on Re^3: unicode strings without decoding or warnings or corruption

Replies are listed 'Best First'.
Re^4: unicode strings without decoding or warnings or corruption
by Khen1950fx (Canon) on May 13, 2012 at 20:49 UTC
    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 "