Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Convert JSON to Perl and back with unicode

by choroba (Archbishop)
on Apr 11, 2020 at 00:00 UTC ( #11115353=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #! /usr/bin/perl
    use warnings;
    use strict;
    ...
    binmode STDERR, ':encoding(UTF-8)';
    print STDERR Dumper(\%mydatatoshow);
    print STDERR Dumper(\%mydatatoshow) =~ s/\\x\{([0-9a-f]{2,})\}/chr(hex
    +($1))/ger;
    
  2. or download this
    s/((\\+)x\{([0-9a-f]{2,})\})/
        (length($2) % 2) ? substr($2, 1) . chr hex $3 : $1/ger;
    
  3. or download this
    #! /usr/bin/perl
    use warnings;
    ...
    
    eval $dumper_choroba;
    is_deeply $VAR1, \%datatoshow;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2020-08-12 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (64 votes). Check out past polls.

    Notices?