Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D11EE466 for ; Wed, 30 Jan 2013 07:47:46 +0000 (UTC) Received: (qmail 54544 invoked by uid 500); 30 Jan 2013 07:47:44 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 54287 invoked by uid 500); 30 Jan 2013 07:47:44 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 54241 invoked by uid 99); 30 Jan 2013 07:47:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 07:47:42 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [212.227.17.11] (HELO mout.web.de) (212.227.17.11) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 07:47:34 +0000 Received: from 3capp-webde-bs30.server.lan ([172.19.170.30]) by mriweb.server.lan (mriweb002) with ESMTPA (Nemesis) id 0Ltjsx-1V1GK72Eqb-010wFf for ; Wed, 30 Jan 2013 08:47:14 +0100 Received: from [192.53.103.200] by 3capp-webde-bs30.server.lan with HTTP; Wed Jan 30 08:47:14 CET 2013 MIME-Version: 1.0 Message-ID: From: "Thomas Bock" To: user@couchdb.apache.org Subject: Re: lexical error: invalid character inside string Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 30 Jan 2013 08:47:14 +0100 (CET) Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K0:Rv1HNIG4mCoTp1KzbCrssE+h3MPMiFyJW8NNpKuofqr /ad/rK5r/lxi0AbLLch9uJjZfm9+JOX7bxIyLuC2Ik4oRVGabu 8U5lc+rDRRV+Wym+ZQIF0Rx8g8XjSIfGWG1euU8GcVtakDIDlq dB1UaRGbube7mpDv9LiOR+r/5F9XlHGD6CK7WLgWC9W2ryt7rc UUSI/+qnykUfIDpZN2XrIPYLHC23OF75zxQNRyrerj1LefbxWD QOn7JFbmVM7hW4CCE5SdM/q8auPPgXxoTFpx29B73zDL+9eP9Y WqRJ9oeWEJyUNKFQ00gF4CYpLzQ X-Virus-Checked: Checked by ClamAV on apache.org Thank you for the answer! > >=C2=A0 curl -X PUT --data '{"a": "\r"}' --he= ader "Content-Type: application/json" > http://localhost:5984/r_test/ab7a >= > I think JSON does not allow literal returns/newlines (or other > control= characters) inside strings; they have to be backslash- =C2=A0But the curl= line works; and in futon I also can type in a simple \r > escaped. It=E2= =80=99s hard to follow exactly what=E2=80=99s going on through all the > le= vels of quoting and unquoting that happen in the shell and in the > Erlang = output, but I think you haven=E2=80=99t escaped that \r enough =E2=80=94 it= > probably needs to be "\\\r". =C2=A0This ("\\\r") don't work; "\\r" work= s. Since \r is the end sign of a gauge (and it don't accept any other) for = a measurement value query I need a reliable way. > > FYI, as a side note, = I=E2=80=99ve found the =E2=80=98httpie=E2=80=99[1] utility a lifesaver > wh= en talking to CouchDB (and other REST/JSON APIs) from the command > line. I= t=E2=80=99s like a souped-up curl with a much clearer syntax for > setting = query parameters, and the ability to easily specify a JSON > body. For exam= ple, I can run your same command as: > >=C2=A0=C2=A0=C2=A0 http PUT :5984/r= _test/ab7a a=3D'\r=E2=80=99 > > =E2=80=94Jens > > [1]: https://github.com/j= kbr/httpie