laziness, impatience, and hubris | |
PerlMonks |
Re: RFC: Perl<->JSON<->YAML<->Dumper : roundtripping and possibly with unicode (Data::Dumper::AutoEncode)by 1nickt (Canon) |
on Apr 10, 2020 at 15:29 UTC ( [id://11115326]=note: print w/replies, xml ) | Need Help?? |
Hi bliako, Are you familiar with Data::Dumper::AutoEncode?
use strict; use warnings; use feature 'say'; use utf8; use Data::Dumper; use Data::Dumper::AutoEncode; my $data = { русский => 'доверяй, но проверяй', i中文 => '也許你的生活很有趣', Ελληνικά => 'ἓν οἶδα ὅτι οὐδὲν οἶδα', }; say Dumper $data; say eDumper $data; __END__
Output:
$ perl bliako.pl $VAR1 = { "\x{440}\x{443}\x{441}\x{441}\x{43a}\x{438}\x{439}" => "\x{434}\x{43e}\x{432}\x{435}\x{440}\x{44f}\x{439}, \x{43d}\x{43e} \x{43f}\x{440}\x{43e}\x{432}\x{435}\x{440}\x{44f}\x{439}", "i\x{4e2d}\x{6587}" => "\x{4e5f}\x{8a31}\x{4f60}\x{7684}\x{751f}\x{6d3b}\x{5f88}\x{6709}\x{8da3}", "\x{395}\x{3bb}\x{3bb}\x{3b7}\x{3bd}\x{3b9}\x{3ba}\x{3ac}" => "\x{1f13}\x{3bd} \x{3bf}\x{1f36}\x{3b4}\x{3b1} \x{1f45}\x{3c4}\x{3b9} \x{3bf}\x{1f50}\x{3b4}\x{1f72}\x{3bd} \x{3bf}\x{1f36}\x{3b4}\x{3b1}" }; $VAR1 = { 'русский' => 'доверяй, но проверяй', 'Ελληνικά' => 'ἓν οἶδα ὅτι οὐδὲν οἶδα', 'i中文' => '也許你的生活很有趣' };
Hope this helps!
The way forward always starts with a minimal test.
In Section
Meditations
|
|