Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 7956 invoked from network); 25 Nov 2010 18:41:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 Nov 2010 18:41:38 -0000 Received: (qmail 91687 invoked by uid 500); 25 Nov 2010 18:41:36 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 91533 invoked by uid 500); 25 Nov 2010 18:41:36 -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 91525 invoked by uid 99); 25 Nov 2010 18:41:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Nov 2010 18:41:36 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of robert.newson@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Nov 2010 18:41:30 +0000 Received: by qyk29 with SMTP id 29so1302218qyk.11 for ; Thu, 25 Nov 2010 10:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=40BXnU+e2QnaEBk91Gt2EoqVR4wtU+Nidgdy6zJjVz8=; b=eo6BmX48rbmNZgdrB0mGiye16FsWOTCYizw8jS/10q+UPCeBB7gweEZluawYVMZg/Q XQxC1w91/W96KmQQH9flj/AleA0gsqJ6SSHO/QM6vZVDJpUm/wPTC2ikciNNGzxqt3DK 6flZnfE+JDldbM9EXqZZO3Z6D1ca2hRPJq7vg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=YeRv9xZWe68fAZUCBrXdEIb3PFdHfV34rSAkfV0tKR55sj2fOfNyYaDl5eCZAq0ruD jJZo1bUgCBfw+jtropiBXu2xq+qB/DwyRMEhHei8Xlh25/quvnkRN+VpUz0TcuObv6uA Oxwe0mBtsZcMcyODZTMDipxsnSOs5fa1EnuVw= MIME-Version: 1.0 Received: by 10.224.19.213 with SMTP id c21mr1006922qab.326.1290710469237; Thu, 25 Nov 2010 10:41:09 -0800 (PST) Received: by 10.220.175.141 with HTTP; Thu, 25 Nov 2010 10:41:09 -0800 (PST) In-Reply-To: References: Date: Thu, 25 Nov 2010 18:41:09 +0000 Message-ID: Subject: Re: curl POST to couchdb's _temp_view on OSX => invalid UTF-8 From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Because this; {"map": "function(doc) {emit(null, doc) }" is not valid JSON. Try this; {"map": "function(doc) {emit(null, doc) }"} B. On Thu, Nov 25, 2010 at 6:36 PM, Florian Leitner wrote: > Hi there, > > I've got a peculiar problem with the UTF-8 encoding in CouchDB. I > installed the latest CouchDBX.app 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 > "hello-world"): > > $ curl-json -vX POST "$DB/_temp_view" -d '{"map": "function(doc) { > emit(null, doc) }"' > * About to connect() to 127.0.0.1 port 5984 (#0) > * =A0 Trying 127.0.0.1... connected > * Connected to 127.0.0.1 (127.0.0.1) 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 Open= SSL/0.9.8l zlib/1.2.3 >> Host: 127.0.0.1:5984 >> Accept: */* >> Content-Type: application/json;charset=3Dutf-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=3Dutf-8 > < Content-Length: 54 > < Cache-Control: must-revalidate > < > {"error":"bad_request","reason":"invalid UTF-8 JSON"} > * Connection #0 to host 127.0.0.1 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=3D'curl -H"Content-Type: application/json;charset=3Dutf-8= "' > > I've also tried to leave out the charset part, naturally, to no avail. > DB is set to (as guessed): > > DB=3Dhttp://127.0.0.1:5984/hello-world > > 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. > > Thanks, > Florian >