Re: Perl and bad characters - Solved!

2018-04-07 Thread Bill Stephenson
I found the simple “append” solution I was looking for on stackoverflow.com: https://stackoverflow.com/questions/21718486/need-to-add-new-data-to-json-array-in-perl Thank you all again for the help! I’ve

Re: Perl and bad characters - Progress!

2018-04-07 Thread Bill Stephenson
As per the advice given I took a different route and used LWP to get and put the document. And I’m going the ditch the building of the JSON like so: my $returnJSON = qq`{"_id": "$_id", "_rev": "$_rev", "title": "$title", "subtitle": "$subtitle", "content": "$content", "docType": "text",

Re: Perl and bad characters

2018-04-07 Thread Dave Cottlehuber
On Sat, 7 Apr 2018, at 07:24, Bill Stephenson wrote: > I’ve been working on a “comments” feature for my “CherryPC blog”. > > I don’t want readers to have to make a user account to comment so I’m > wanting to use a perl script on the server side that has the user > credentials in the $url variable

Re: Perl and bad characters

2018-04-07 Thread Raimund Riedel
The internal representation of character strings in Perl-5 is not identical to UTF-8 or UTF-X, although they both may occur in the same string variable. There is no automatic conversion; the "use utf8;" pragma is only to enable Perl-5 source code written in UTF-8 (see "perldoc utf8").

Re: Perl and bad characters

2018-04-07 Thread Michael Zedeler
Hi Bill. You need to escape the characters and unescape them again when you retrieve them from the server. What you should do is something like this: use JSON; use HTTP::Request::Common; my $result = PUT $url, Content_Tipe => 'application/json', Content => encode_json($data_structure); My

RE: Perl and bad characters

2018-04-07 Thread Keith Gable
The last line is you taking user input and putting it into a shell argument without escaping. Use a real HTTP library so that you don’t get exploited by a robot. Does this still persist if you use a real HTTP library? From: Bill Stephenson