Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I used Data::Dump::dd to dump a large data structure which included unicode strings, but all is not well as the following program (play with it) demonstrates
#!/usr/bin/perl -- use strict; use warnings; #~ use utf8; # no help #~ use feature 'unicode_strings'; # no help # turns off wide but CORRUPTS output #~ binmode STDOUT, ':encoding(UTF-8)'; binmode STDOUT; # wide character in print print qq!\x{FEFF}!; # print BOM print "Foo \xE2\x80\x94 Bar";
use utf8 is no help
use feature 'strings' is no help
using only binmode produces wide character in print
binmode UTF-8 corrupts the file
I do not want to iterate over my huge hash of hashes to Encode::decode('UTF-8')
I must be missing something, but what? How do I get unicode strings without manually calling decode, and print them, without lame warnings or corruption?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unicode strings without decoding or warnings or corruption
by Corion (Patriarch) on May 13, 2012 at 10:17 UTC | |
| |
|
Re: unicode strings without decoding or warnings or corruption
by Anonymous Monk on May 13, 2012 at 10:45 UTC | |
by Corion (Patriarch) on May 13, 2012 at 11:30 UTC | |
by Anonymous Monk on May 13, 2012 at 11:46 UTC | |
by Khen1950fx (Canon) on May 13, 2012 at 20:49 UTC | |
by Anonymous Monk on May 14, 2012 at 04:39 UTC |