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

Re: parsing json, problem with encodings

by Your Mother (Archbishop)
on Mar 20, 2014 at 19:01 UTC ( [id://1079134]=note: print w/replies, xml ) Need Help??


in reply to parsing json, problem with encodings

Looks okay, I think. Just being escaped by the dumping code.

~>perl -CSD -le'print "\x{3a3}\x{391}\x{39b}\x{3a4}\x{3a3}\x{39c}\x{3a0}\x{39f}\x{3a5}\x{3a1}\x{393}\x{39a}"'
ΣΑΛΤΣΜΠΟΥΡΓΚ

You might try printing out of the perl variables directly, for example print $decoded_json->{SOME_KEY}, instead of via the dumper. You may have to adjust for encoding layers, but it looks like you’re doing it right so far.

Replies are listed 'Best First'.
Re^2: parsing json, problem with encodings
by kimlid2810 (Acolyte) on Mar 20, 2014 at 19:13 UTC
    yeah, you 're right... if don't go with Dumper everything seems ok... i can't start describing how angry i feel for all this time i spent blaming the json... i think i will go and start a farm or something... computers are not for me :( thanks however

      I spent hours one evening trying to fix a bug caused by a missing } that happened to fall where the syntax checks refused to tell me accurately where and what was going on (this was an older perl that was weak in this area). Whenever I changed something, the error jumped to a new place. Hours. We all have these moments. Those who are too stubborn to give up start to get paid for it eventually. :P

      Same experience just end of last week and beginning of this week: I wasted at least 4 to 4.5 days on a PL/SQL script (a rather simple one, about I would say 300 lines of code) that just stubbornly refused to do what I wanted (I could have made the script in 3 to 4 hours, perhaps even less, in Perl using DBI, but the client did not want that, they insisted on me using PL/SQL, a language that I have used not very much, and it was at least 5 years ago the last time I used it). I stumbled for days on a really stupid problem, namely that if an exception is raised by Oracle (say "no data found"), then the rest of the code of the procedure if not executed, even if you do what is needed to manage the exception. I did not know that, or had forgotten, and did not have a coworker who could help me, we are not using PL/SQL regularly. And it took me ages of debugging time, printing out variables values every other instruction, before I understood what was going wrong. Yes, I was really getting frustrated and angry at not being to solve the problem, but the upside is that I was so happy yesterday when I finally found the solution that I now almost feel good about the whole anecdote. Sorry it that sounds slightly off-topic, my example is not Perl, but I think that you sometimes have these problems and it is good to share about them.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 23:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found