Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 34710 invoked from network); 13 Apr 2009 22:40:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Apr 2009 22:40:31 -0000 Received: (qmail 35511 invoked by uid 500); 13 Apr 2009 22:40:30 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 35421 invoked by uid 500); 13 Apr 2009 22:40:30 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 35411 invoked by uid 99); 13 Apr 2009 22:40:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Apr 2009 22:40:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jchris@gmail.com designates 209.85.221.112 as permitted sender) Received: from [209.85.221.112] (HELO mail-qy0-f112.google.com) (209.85.221.112) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Apr 2009 22:40:20 +0000 Received: by qyk10 with SMTP id 10so3807919qyk.13 for ; Mon, 13 Apr 2009 15:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=FlC9gp3EBaScy7x5myLr5bfJZqe1al/JLjvakfWWVvg=; b=rqotj/HKQzk1c7WM5U0dBwn1Pe1wZhmTpVArEOQnoTRAO6ITJKLCP5z7m6zw2++WHm bYf0ktR7WWpVDefHiJJ9NsSLpOqiQrMSZrZP0aC13Ph2wq7HGK/FGOB4SMjodGx9NXGW r/n+SBKrLhRze+jSin45Ck5a0ojr4XL7Xte6k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=Yb7dUIlHFNXsm0TttPhvLVEl4k6nw9ba7qySOeQ4frtAf3p4FqvHQ//TAYVY5suFw+ JcxlVavK1eYqv/Q6RROhBcVtDe6juJZ32wlur2zFtUA9aZt+e7OCO7iBf/ms7kVu894C tV8JmioJRj+O1cDCVPpBOxV5JYijOo1akxVP0= MIME-Version: 1.0 Sender: jchris@gmail.com Received: by 10.220.45.208 with SMTP id g16mr7130216vcf.111.1239662399640; Mon, 13 Apr 2009 15:39:59 -0700 (PDT) In-Reply-To: <946031239662050@webmail127.yandex.ru> References: <946031239662050@webmail127.yandex.ru> Date: Mon, 13 Apr 2009 15:39:59 -0700 X-Google-Sender-Auth: c572cf4165b8deb3 Message-ID: Subject: Re: unicode output representation From: Chris Anderson To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Apr 13, 2009 at 3:34 PM, dmi wrote: > Hello All! > > CouchDB now using modified version of mochijson2 for JSON output. > The standard behavior of this library is to accept unicode in all forms (unicode, utf8, \uXXXX) via decode/1, > but when unicode is emitted via encode/1 to the client app, all unicode symbols are converted to \uXXXX form. > > This is done for maximal compatibility. But I suspect, that modern software, which may want to interact with CouchDB, will have no problems with raw UTF8. > > Recent version of mochiweb (r99) introduces an optional capability for mochijson2 to emit raw utf8. > The proposed way is: > > Encoder = mochijson2:encoder([{utf8, true}]), > JSON = Encoder(json()) > > I have tested this patch (in reduced form) against CouchDB and it seems to be working. > > I think, that bringing this option to CouchDB will be a good improvement for developers of international software. > Thanks for digging in here. To avoid incompatibility with old software, we may want to either: - make this a request time option - switch intelligently on some http request header Any thoughts on how best to do this? Should utf8 be the default, or \uXXXX? Once we have these questions answered, if you put a patch in JIRA[1] it's likely to be accepted. [1] http://issues.apache.org/jira/browse/COUCHDB -- Chris Anderson http://jchrisa.net http://couch.io