Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 4 Feb 2014 18:40:18 +0000 (20:40 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:44 +0000 (09:59 -0800)
95/7b55405122e5f34eb28bb84dbdd3dc57668829 [new file with mode: 0644]

diff --git a/95/7b55405122e5f34eb28bb84dbdd3dc57668829 b/95/7b55405122e5f34eb28bb84dbdd3dc57668829
new file mode 100644 (file)
index 0000000..23144df
--- /dev/null
@@ -0,0 +1,125 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A87E3431FBD\r
+       for <notmuch@notmuchmail.org>; Tue,  4 Feb 2014 10:40:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id tTb7boxQsUGJ for <notmuch@notmuchmail.org>;\r
+       Tue,  4 Feb 2014 10:40:23 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id A8F0F431FBC\r
+       for <notmuch@notmuchmail.org>; Tue,  4 Feb 2014 10:40:23 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 187C6100033;\r
+       Tue,  4 Feb 2014 20:40:19 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: "W. Trevor King" <wking@tremily.us>\r
+Subject: Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general\r
+       refactoring\r
+In-Reply-To: <20140204161142.GS14197@odin.tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+       <m2ha8frjgg.fsf@guru.guru-group.fi>\r
+       <20140204005331.GQ14197@odin.tremily.us>\r
+       <m2fvnzp3uh.fsf@guru.guru-group.fi>\r
+       <20140204161142.GS14197@odin.tremily.us>\r
+User-Agent: Notmuch/0.17+55~g4397960 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Tue, 04 Feb 2014 20:40:18 +0200\r
+Message-ID: <m2a9e6zppp.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 04 Feb 2014 18:40:28 -0000\r
+\r
+On Tue, Feb 04 2014, "W. Trevor King" <wking@tremily.us> wrote:\r
+\r
+>\r
+>   >>> from __future__ import unicode_literals\r
+>   >>> import codecs\r
+>   >>> import locale\r
+>   >>> import sys\r
+>   >>> print(locale.getpreferredencoding())  # same as yours\r
+>   UTF-8\r
+>   >>> print(sys.getdefaultencoding())  # same as yours\r
+>   ascii\r
+>   >>> _ENCODING =3D locale.getpreferredencoding() or sys.getdefaultencodi=\r
+ng()\r
+>   >>> print(_ENCODING)  # double-check default encodings\r
+>   UTF-8\r
+>   >>> byte_stream =3D sys.stdout  # copied from Page.write\r
+>   >>> stream =3D codecs.getwriter(encoding=3D_ENCODING)(stream=3Dbyte_str=\r
+eam)\r
+>   >>> data =3D {'from': '\u017b'}  # fake the troublesome data\r
+>   >>> print(type(data['from']))  # double-check unicode_literals\r
+>   <type 'unicode'>\r
+>   >>> string =3D '  <td>{from}</td>\n'.format(**data)\r
+>   >>> stream.write(string)\r
+>     <td>=C5=BB</td>\r
+>\r
+> It looks like you'll have the same _ENCODING as I do (UTF-8).  That\r
+> means your stream should be wrapped in a UTF-8 StreamWriter, so I\r
+> don't understand why it's converting to ASCII.  Can you run through\r
+> the above on your troublesome machine and confirm that stream.write()\r
+> is still raising the exception?  If it doesn't work, can you just\r
+> paste that whole run in your next email?\r
+\r
+I don't know what to paste, so i paste this:\r
+\r
+$ python\r
+Python 2.6.6 (r266:84292, Nov 21 2013, 12:39:37)=20\r
+[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2\r
+Type "help", "copyright", "credits" or "license" for more information.\r
+>>> data =3D {'from': '\u017b'}\r
+>>> print(type(data['from']))=20\r
+<type 'str'>\r
+>>> string =3D '  <td>{from}</td>\n'.format(**data)\r
+>>> print string\r
+  <td>\u017b</td>\r
+\r
+and then:\r
+\r
+>>> data =3D {'from': u'\u017b'}\r
+>>> print(type(data['from']))=20\r
+<type 'unicode'>\r
+>>> string =3D '  <td>{from}</td>\n'.format(**data)\r
+Traceback (most recent call last):\r
+  File "<stdin>", line 1, in <module>\r
+UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in\r
+>>> position 0: ordinal not in range(128)\r
+\r
+... and ...\r
+\r
+>>> import os\r
+>>> print os.environ['LANG']\r
+en_US.UTF-8\r
+\r
+\r
+> Thanks,\r
+> Trevor\r
+\r
+\r
+Tomi\r