couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Bock" <thsteinb...@web.de>
Subject lexical error: invalid character inside string
Date Tue, 29 Jan 2013 17:04:56 GMT

Dear List,

I can not figure out what's wrong here. At first:

 curl -X PUT --data '{"a": "\r"}' --header "Content-Type: application/json" http://localhost:5984/r_test/ab7a
 
works. However, if I use RCurl to send
{\n \"a\": \"\r\" \n}
              ^
I got

[error] [<0.8201.0>] attempted upload of invalid JSON (set log_level to debug to log
it)
[debug] [<0.8201.0>] Invalid JSON: {{error,
                                     {9,
                                      "lexical error:
invalid character inside string.\n"}},
                                    <<"{\n \"a\":
\"\r\" \n}">>}

but with {\n \"a\": \"\\r\" \n}
                      ^^
the same way (RCurl) workes fine. In futon I can have "\r" also.

Maybe someone have some (also general) hints?

Regards
Thomas



Here is some more info:

\\r is working:
## > PUT /r_test/e74e4233746b1ef5605751489d010d54 HTTP/1.1
## Host: localhost:5984
## Accept: */*
## Content-Type: application/json
## Content-Length: 16
##
## * upload completely sent off: 16 out of 16 bytes
## < HTTP/1.1 201 Created
## < Server: CouchDB/1.2.0 (Erlang OTP/R15B02)
## < Location: http://localhost:5984/r_test/e74e4233746b1ef5605751489d010d54
## < ETag: "1-5efc54426509641a0a109a756b96eaa7"
## < Date: Tue, 29 Jan 2013 16:19:18 GMT
## < Content-Type: text/plain; charset=utf-8
## < Content-Length: 95
## < Cache-Control: must-revalidate
## <
## * Connection #0 to host localhost left intact
## >

\r not working
## > PUT /r_test/e74e4233746b1ef5605751489d010e23 HTTP/1.1
## Host: localhost:5984
## Accept: */*
## Content-Type: application/json
## Content-Length: 14
##
## * upload completely sent off: 14 out of 14 bytes
## < HTTP/1.1 400 Bad Request
## < Server: CouchDB/1.2.0 (Erlang OTP/R15B02)
## < Date: Tue, 29 Jan 2013 16:20:54 GMT
## < Content-Type: text/plain; charset=utf-8
## < Content-Length: 48
## < Cache-Control: must-revalidate
## <
## * Connection #0 to host localhost left intact
## Fehler in cdbAddDoc(ccc) (von #37) :  bad_request
## >

Mime
View raw message