Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Data::Dumper and utf8

by brycen (Monk)
on Aug 13, 2010 at 21:28 UTC ( #855007=note: print w/replies, xml ) Need Help??


in reply to Data::Dumper and utf8

The difference with $Data::Dumper::Useperl = 1; is related to strings that can be represented entirely without utf8. On ingest eval makes the usual perl heuristic about utf8, and gets it wrong:
#!/usr/bin/perl -w use utf8; # so source code is utf-8 encoded use Data::Dumper; $data1 = ' ☺'; # a-umlaut, space, smiley $data2 = ' '; # a-umlaut, space, space $Data::Dumper::Useperl = 1; $dump1 = Dumper( $data1 ); print $dump1; $dump2 = Dumper( $data2 ); print $dump2; print "\n"; $Data::Dumper::Useperl = 0; $dump1 = Dumper( $data1 ); print $dump1; $dump2 = Dumper( $data2 ); print $dump2; print "\n";

Output

$VAR1 = "\x{e4} \x{263a}"; $VAR1 = ' '; $VAR1 = "\x{e4} \x{263a}"; $VAR1 = "\x{e4} ";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://855007]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-12-08 22:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?