http://qs1969.pair.com?node_id=855007


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} ";