I need to escape the "ñ" #3011
Answered
by
janl
hamiltonsalazar
asked this question in
Q&A
-
|
I want to a db and i can do this on Windows: And CouchDB responds: * Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)
* Server auth using Basic with user 'anna'
> POST /pruebaproyecto/_find HTTP/1.1
> Host: 127.0.0.1:5984
> Authorization: Basic YW5uYTpzZWNyZXQ=
> User-Agent: curl/7.55.1
> Accept: application/json
> Content-Type: application/json
> Content-Length: 758
>
* upload completely sent off: 758 out of 758 bytes
< HTTP/1.1 200 OK
< Cache-Control: must-revalidate
< Content-Type: application/json
< Date: Sun, 19 Jul 2020 01:08:42 GMT
< Server: CouchDB/3.1.0 (Erlang OTP/20)
< Transfer-Encoding: chunked
< X-Couch-Request-ID: 70be698066
< X-CouchDB-Body-Time: 0
<
{"docs":[
{"_id":"112","name":"Nicolás","secondName":"Carlos","lastName":"Medina","secondLastName":"Rojas","scores":[5,1,2,2,1,6]},
{"_id":"12","name":"Ava","secondName":"Adeline","lastName":"Cárdenas","secondLastName":"Restrepo","scores":[1,7,4,4,5,9,9,8]},
{"_id":"122","name":"Renata","secondName":"Charlotte","lastName":"Arias","secondLastName":"Ramírez","scores":[9,0,5,9,7,8,8]},
{"_id":"123","name":"Matías","secondName":"Matías","lastName":"Jaramillo","secondLastName":"Restrepo","scores":[0,5,4,2,5,9,1,7]},
{"_id":"124","name":"Carlos","secondName":"Nicol├ís","lastName":"Arias","secondLastName":"Jim├®nez","scores":[9,0,4,8,4,6,3,0]},
{"_id":"128","name":"Adeline","secondName":"Evelyn","lastName":"Flórez","secondLastName":"González","scores":[9,1,7,3,2,9,7,2,7]},
{"_id":"130","name":"Amalia","secondName":"Amalia","lastName":"Rodríguez","secondLastName":"Marín","scores":[7,2,1,7,0,4,9,2,7]},
{"_id":"138","name":"Adelaide","secondName":"Eleanor","lastName":"Arias","secondLastName":"Mejía","scores":[7,9,8,5,4,9,9,5]},
{"_id":"142","name":"Adeline","secondName":"Regina","lastName":"Medina","secondLastName":"Medina","scores":[8,2,4,0,9,2,0,6]},
{"_id":"144","name":"Miguel","secondName":"Diego","lastName":"Salazar","secondLastName":"Velásquez","scores":[5,3,3,8,4,6,9,6,8,0]},
{"_id":"147","name":"Valent├¡n","secondName":"Carlos","lastName":"C├írdenas","secondLastName":"P├®rez","scores":[1,9,3,8,3]},
{"_id":"151","name":"Isla","secondName":"Lucy","lastName":"Ramírez","secondLastName":"Flórez","scores":[6,8,1,3,5,2]},
{"_id":"157","name":"Pablo","secondName":"Matías","lastName":"Cardona","secondLastName":"Gómez","scores":[1,4,9,2,7,9,2,7,0]},
{"_id":"158","name":"Julia","secondName":"Valeria","lastName":"Restrepo","secondLastName":"Jaramillo","scores":[8,4,6,5,1,5,5,9,6,5]},
{"_id":"166","name":"Pablo","secondName":"Benjamín","lastName":"Castro","secondLastName":"Díaz","scores":[5,0,0,5,8,2,4,1]},
{"_id":"176","name":"Gabriel","secondName":"Thiago","lastName":"Rojas","secondLastName":"García","scores":[4,7,2,8,9,3,0]},
{"_id":"180","name":"Verónica","secondName":"Sofía","lastName":"Mejía","secondLastName":"Escobar","scores":[9,2,4,2,0]},
{"_id":"181","name":"Martín","secondName":"Simón","lastName":"Valencia","secondLastName":"Muñoz","scores":[1,9,6,4,0,3,5,4]},
{"_id":"182","name":"Ava","secondName":"Olivia","lastName":"Torres","secondLastName":"Rojas","scores":[9,5,9,9,5,0]},
{"_id":"189","name":"Valeria","secondName":"Evelyn","lastName":"Quintero","secondLastName":"Cárdenas","scores":[7,2,2,1,5,8]},
{"_id":"195","name":"Dante","secondName":"Diego","lastName":"P├®rez","secondLastName":"Rojas","scores":[8,9,4,1,7]},
{"_id":"201","name":"Dulce","secondName":"Alice","lastName":"Rojas","secondLastName":"Osorio","scores":[4,4,4,6,8,6,2,0,7]},
{"_id":"203","name":"Amalia","secondName":"Cora","lastName":"Zapata","secondLastName":"Romero","scores":[1,7,8,1,4,0,0,5]},
{"_id":"208","name":"Ángel","secondName":"Julián","lastName":"Muñoz","secondLastName":"Cardona","scores":[8,7,6,7,9,0,7,6]},
{"_id":"211","name":"Sergio","secondName":"Pablo","lastName":"Quintero","secondLastName":"Morales","scores":[3,0,6,1,8,7,0,0,1]}
],
"bookmark": "g1AAAAA2eJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYozGxkagqQ4YFIwwSwAfeUN4w",
"execution_stats": {"total_keys_examined":0,"total_docs_examined":0,"total_quorum_docs_examined":0,"results_returned":25,"execution_time_ms":219.0},
"warning": "No matching index found, create an index to optimize query time."}
* Connection #0 to host 127.0.0.1 left intact
But if i want to send the full word And CouchDB responds with: * Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)
* Server auth using Basic with user 'anna'
> POST /pruebaproyecto/_find HTTP/1.1
> Host: 127.0.0.1:5984
> Authorization: Basic YW5uYTpzZWNyZXQ=
> User-Agent: curl/7.55.1
> Accept: application/json
> Content-Type: application/json
> Content-Length: 760
>
* upload completely sent off: 760 out of 760 bytes
< HTTP/1.1 400 Bad Request
< Cache-Control: must-revalidate
< Content-Length: 54
< Content-Type: application/json
< Date: Sun, 19 Jul 2020 01:18:41 GMT
< Server: CouchDB/3.1.0 (Erlang OTP/20)
< X-Couch-Request-ID: 8b440c8622
< X-CouchDB-Body-Time: 0
<
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
* Connection #0 to host 127.0.0.1 left intact
|
Beta Was this translation helpful? Give feedback.
Answered by
janl
Jul 20, 2020
Replies: 2 comments 4 replies
-
|
Does -H "Content-Type: application/json; charset=utf-8" solve the problem? |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
try saving the POST data in a file and use |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
janl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try saving the POST data in a file and use
--data-binary @filename.jsoninstead of-d …. That then rules out any terminal/shell encoding issues.