Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF6261064D for ; Fri, 3 Jan 2014 14:44:16 +0000 (UTC) Received: (qmail 74240 invoked by uid 500); 3 Jan 2014 14:41:51 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 74136 invoked by uid 500); 3 Jan 2014 14:41:39 -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 74062 invoked by uid 99); 3 Jan 2014 14:41:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jan 2014 14:41:21 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [81.169.146.218] (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.218) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jan 2014 14:41:17 +0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1388760055; l=6116; s=domk; d=gonvaled.com; h=Content-Type:To:Subject:Date:From:References:In-Reply-To: MIME-Version:X-RZG-CLASS-ID:X-RZG-AUTH; bh=FqxPjU2QeBSGI6LmlE2LR2LiTTQ=; b=PIdFgIyVNPVlX+rFuHuduFEca1RniS2HDEtPBymjvGHU2h+V5aG6D45UzB7XzPs7Apf OIKRWIm8Xlo5mqEuljq+/tcc0OrOS8Ypx5D40UzXweapcmgvPewVsTmoGExnFZ16uvxbJ oHSUhpdAWO6oV29PLIvA/S2wTqGbzaRqrow= X-RZG-AUTH: :K2MKY0GkfvuAYI9OvLYEA55J0qvTZZULi9CTHjqnn8/d41Z9VA5z1TAdhRyESfE= X-RZG-CLASS-ID: mo00 Received: from mail-oa0-f49.google.com ([209.85.219.49]) by smtp.strato.de (RZmta 32.17 AUTH) with (TLSv1:DHE-RSA-AES256-SHA encrypted) ESMTPSA id w02918q03EetpPH for ; Fri, 3 Jan 2014 15:40:55 +0100 (CET) Received: by mail-oa0-f49.google.com with SMTP id i4so16076417oah.36 for ; Fri, 03 Jan 2014 06:40:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=HCzCS02W1G/vuT80Z9JQtX2+TB7GODfCy7kqHno6lKo=; b=AQH3euum9F1bDDWehtCdoHadX+I3a+sL9nPUok7WRAaOQ0LZMJ1vb/ygtIRvyCVVd4 G0i9TT7Y7DstTwToHI91BPu4ltCCJhE5tkIYuHtAtgwe/jxCp8+jqrn4gVaBJh8L27lR XkjHRq4ZDprgsoOlWQ7bX8pZB8+Z0wzSUK9aSTgQFpGppr5hWNseXDkF3AyjSNPWE6IH PDZ4Ek5rrIbqm0W+GRmPtKJZvOU3qMmnaFVigoiRHPRmRAwKfqN2D36LaiMHUcAUd65p g4u6hkl2dl7M9l41pA2TVj1J7QveOxFcXTCvFyKipbOHJWajI/4VLIS7ZH01ze0VpQr5 997g== X-Received: by 10.182.117.195 with SMTP id kg3mr58726149obb.17.1388760054336; Fri, 03 Jan 2014 06:40:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.76.133.100 with HTTP; Fri, 3 Jan 2014 06:40:24 -0800 (PST) In-Reply-To: References: From: Daniel Gonzalez Date: Fri, 3 Jan 2014 15:40:24 +0100 Message-ID: Subject: Re: Specify attachment encoding for couchdb To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=089e0149c506b796bf04ef11e5dc X-Virus-Checked: Checked by ClamAV on apache.org --089e0149c506b796bf04ef11e5dc Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable Thanks but, how do you set that on a per-attachment basis in a couchdb document? If this is not supported, I guess I will have to add a mapping "attachments-encoding" to the document where I can associate each attachment with its encoding. Any comments on this? On Fri, Jan 3, 2014 at 3:18 PM, Alexander Shorin wrote: > You can set MIME type as text/plain;charset=3Dutf-8 to help browsers > detect the correct content encoding. > See http://tools.ietf.org/html/rfc2068#section-3.4 for more info > -- > ,,,^..^,,, > > > On Fri, Jan 3, 2014 at 5:52 PM, Daniel Gonzalez > wrote: > > Hi, > > > > I have the following test script: > > > > # -*- coding: utf-8 -*- > > > > import os > > import couchdb > > > > GREEK =3D u'=C1=C2=C3=C4 =C5=C6=C7=C8 =C9=CA=CB=CC =CD=CE=CF=D0 =D1=D3= =D4=D5 =D6=D7=D8=D9 =E1=E2=E3=E4 =E5=E6=E7=E8 =E9=EA=EB=EC =ED=EE=EF=F0 =F1= =F2=F4=F5 =F6=F7=F8=F9' > > > > # Prepare a unicode file, encoded using ENCODING > > ENCODING =3D 'utf-8' > > filename =3D '/tmp/test' > > open(filename, 'w').write(GREEK.encode(ENCODING)) > > > > # Create an empty document > > server =3D couchdb.Server() > > db =3D server['cdb-tests'] > > doc_id =3D 'testing' > > doc =3D { } > > db[doc_id] =3D doc > > > > # Attach the file to the document > > content =3D open(filename, 'rb') # Open the file for reading > > db.put_attachment(doc, content, content_type=3D'text/plain') > > > > As you can see, the file is utf-8 encoded, but when I attach that file = to > > couchdb, I have no way to specify this encoding. Thus, requesting the > > attachment at http://localhost:5984/cdb-tests/testing/test returns the > > following Response Headers: > > > > HTTP/1.1 200 OK > > Server: CouchDB/1.2.0 (Erlang OTP/R15B01) > > ETag: "7y85tiUeF/UX9kqpKAzQEw=3D=3D" > > Date: Fri, 03 Jan 2014 13:43:36 GMT > > Content-Type: text/plain > > Content-MD5: 7y85tiUeF/UX9kqpKAzQEw=3D=3D > > Content-Length: 102 > > Content-Encoding: gzip > > Cache-Control: must-revalidate > > Accept-Ranges: none > > > > Seeing the attachment with a browser shows complete gibberish. How can = I > > store the encoding for couchdb attachments? > > > > Thanks and regards, > > > > Daniel > > > > PD: SO reference link: http://stackoverflow.com/q/20905157/647991 > --089e0149c506b796bf04ef11e5dc--