Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

JSON Problems

by nathanlong85 (Initiate)
on Oct 18, 2012 at 13:27 UTC ( [id://999734]=perlquestion: print w/replies, xml ) Need Help??

nathanlong85 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm having some problems interacting with a JSON API and I'm pretty much out of ideas on where to go from here. It's kind of hard to post examples because I'm not really able to share the information that I'm trying to send...

Anyway, the problem is this: whenever I try to send a character like ß or any non-US characters I get an error back saying that my JSON is unprocessable. If I try the exact same string via curl though from the command-line it's fine, no issues. I'm wondering if Perl is somehow having problems with the encoding... I'm just using LWP::UserAgent to send my json strings and it works for any entries that don't have non-US characters. I know this is kind of vague, I just can't be too specific... maybe somebody has experienced something similar to this before too? Any help would be greatly appreciated!

One odd thing is that if I do a Data::Dumper on my LWP::UserAgent object after sending my json request, if I check out the content of my request it looks just fine... I can literally copy and paste the json string from my request dump into curl and it works

Thanks,

Replies are listed 'Best First'.
Re: JSON Problems
by Anonymous Monk on Oct 18, 2012 at 13:59 UTC
      Looks like encode/decode fixed my problem. I had assumed since the input creating my json string was already coming from a source using UTF-8 and I was sending to a destination using UTF-8 that it wouldn't be an issue... thanks for that link, it was really helpful!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://999734]
Approved by Corion
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found