Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to RFC: Perl<->JSON<->YAML<->Dumper : roundtripping and possibly with unicode

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.
  • Comment on Re: RFC: Perl<->JSON<->YAML<->Dumper : roundtripping and possibly with unicode (Data::Dumper::AutoEncode)

Replies are listed 'Best First'.
Re^2: RFC: Perl<->JSON<->YAML<->Dumper : roundtripping and possibly with unicode (Data::Dumper::AutoEncode)
by bliako (Monsignor) on Apr 11, 2020 at 07:48 UTC

    Thanks 1nickt for the pointer. I may replace the Dumper part with this then!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found