couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Leitner <>
Subject Fwd: curl POST to couchdb's _temp_view on OSX => invalid UTF-8
Date Thu, 25 Nov 2010 18:36:24 GMT
Hi there,

I've got a peculiar problem with the UTF-8 encoding in CouchDB. I
installed the latest for
OSX (CouchDB version 1.0.1, curl version 7.19.7, OSX version 10.6.4)
and all worked nicely so far. However, now I am trying to POST to the
_temp_view of my "hello-world" database, and I get the "invalid UTF-8
JSON" error without knowing what I am doing wrong - curl worked nicely
for all other commands and if I run the view from Futon, it works
nicely, too. Here is what happens with curl (I have three documents in

$ curl-json -vX POST "$DB/_temp_view" -d '{"map": "function(doc) {
emit(null, doc) }"'
* About to connect() to port 5984 (#0)
*   Trying connected
* Connected to ( port 5984 (#0)
> POST /hello-world/_temp_view HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host:
> Accept: */*
> Content-Type: application/json;charset=utf-8
> Content-Length: 43
< HTTP/1.1 400 Bad Request
< Server: CouchDB/1.0.1 (Erlang OTP/R13B)
< Date: Thu, 25 Nov 2010 18:19:07 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 54
< Cache-Control: must-revalidate
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
* Connection #0 to host left intact
* Closing connection #0

Here is the request against the database (with some spaces between
key/value pairs to make it readable):

$ curl-json $DB
{"db_name":"hello-world", "doc_count":3, "doc_del_count":6,
"update_seq":16, "purge_seq":0, "compact_running":false,
"disk_size":61529, "instance_start_time":"1290702185923299",
"disk_format_version":5, "committed_update_seq":16}

Last but not least, I've aliased curl-json as such:

alias curl-json='curl -H"Content-Type: application/json;charset=utf-8"'

I've also tried to leave out the charset part, naturally, to no avail.
DB is set to (as guessed):


So can someone tell me why I am getting this UTF-8 issue? I could POST
documents without encoding problems, put now POSTing to _temp_view seems to
fail. Any help appreciated.


View raw message