You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by John Le Brasseur <jo...@gmail.com> on 2017/01/25 18:57:08 UTC

Escape Character: Bash Shell

Hi and sorry.
Another curl command-line escape character question.

This command is not working:

curl -X PUT
http://user:pwd@127.0.0.1:5984/testdb/4e2a2835b2dc1f424b0d5ef14400zzzz -H
"Content-Type: application/json" -d '{"Body":"I decided today that I don't
like baseball. I like plankton."}'

No response or if I alter quotation marks etc.etc. I
get {"error":"bad_request","reason":"invalid UTF-8 JSON"}


I have eliminated everything and the cause is the ' in don't.
I just don't know how to escape the ' correctly.(pun not intended)

I have actually tried every shell I can(Powershell, Bash and Windows
command line)


John

RE: Escape Character: Bash Shell

Posted by Gustavo Delfino <Gu...@zf.com>.
John, on windows this works:

curl -X PUT http://127.0.0.1:5984/testdb/4e2a2835b2dc1f424b0d5ef14400zzzz -H "Content-Type: application/json" -d "{\"Body\":\"I decided today
 that I don't like baseball. I like plankton.\"}"

{"ok":true,"id":"12345","rev":"1-c2f32db9503aab17cee83831fc66bda4"}

Regards,

Gustavo

-----Original Message-----
From: John Le Brasseur [mailto:johnlebrasseur@gmail.com] 
Sent: Wednesday, January 25, 2017 1:57 PM
To: user@couchdb.apache.org
Subject: Escape Character: Bash Shell

Hi and sorry.
Another curl command-line escape character question.

This command is not working:

curl -X PUT
http://user:pwd@127.0.0.1:5984/testdb/4e2a2835b2dc1f424b0d5ef14400zzzz -H
"Content-Type: application/json" -d '{"Body":"I decided today that I don't like baseball. I like plankton."}'

No response or if I alter quotation marks etc.etc. I get {"error":"bad_request","reason":"invalid UTF-8 JSON"}


I have eliminated everything and the cause is the ' in don't.
I just don't know how to escape the ' correctly.(pun not intended)

I have actually tried every shell I can(Powershell, Bash and Windows command line)


John

Re: Escape Character: Bash Shell

Posted by John Le Brasseur <jo...@gmail.com>.
Thank you Gustavo.
Worked on all my shells.
I was trying to escape the apostrophe (') instead of the whole line.
Many many thanks.

On 25 January 2017 at 20:57, John Le Brasseur <jo...@gmail.com>
wrote:

> Hi and sorry.
> Another curl command-line escape character question.
>
> This command is not working:
>
> curl -X PUT http://user:pwd@127.0.0.1:5984/testdb/
> 4e2a2835b2dc1f424b0d5ef14400zzzz -H "Content-Type: application/json" -d
> '{"Body":"I decided today that I don't like baseball. I like plankton."}'
>
> No response or if I alter quotation marks etc.etc. I
> get {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>
>
> I have eliminated everything and the cause is the ' in don't.
> I just don't know how to escape the ' correctly.(pun not intended)
>
> I have actually tried every shell I can(Powershell, Bash and Windows
> command line)
>
>
> John
>



John