Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring
authorW. Trevor King <wking@tremily.us>
Tue, 4 Feb 2014 16:11:42 +0000 (08:11 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:43 +0000 (09:59 -0800)
59/b813a0e3e7d0a378b976f44b4c8ce8f12631d5 [new file with mode: 0644]

diff --git a/59/b813a0e3e7d0a378b976f44b4c8ce8f12631d5 b/59/b813a0e3e7d0a378b976f44b4c8ce8f12631d5
new file mode 100644 (file)
index 0000000..2dae32b
--- /dev/null
@@ -0,0 +1,171 @@
+Return-Path: <wking@tremily.us>\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 14256431FBF\r
+       for <notmuch@notmuchmail.org>; Tue,  4 Feb 2014 08:11:48 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       RCVD_IN_DNSWL_NONE=-0.0001] 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 s82Sr7G7HGYV for <notmuch@notmuchmail.org>;\r
+       Tue,  4 Feb 2014 08:11:44 -0800 (PST)\r
+Received: from qmta15.westchester.pa.mail.comcast.net\r
+       (qmta15.westchester.pa.mail.comcast.net [76.96.59.228])\r
+       by olra.theworths.org (Postfix) with ESMTP id 15CFA431FBC\r
+       for <notmuch@notmuchmail.org>; Tue,  4 Feb 2014 08:11:44 -0800 (PST)\r
+Received: from omta05.westchester.pa.mail.comcast.net ([76.96.62.43])\r
+       by qmta15.westchester.pa.mail.comcast.net with comcast\r
+       id NDmo1n0020vyq2s5FGBj6j; Tue, 04 Feb 2014 16:11:43 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta05.westchester.pa.mail.comcast.net with comcast\r
+       id NGBi1n00h152l3L3RGBjN9; Tue, 04 Feb 2014 16:11:43 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+       id 3679FFCCFD4; Tue,  4 Feb 2014 08:11:42 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+       t=1391530302; bh=Glf6ENRsZMvpYmQY561CbcxBHwd+1peHzU7KHyJaEbo=;\r
+       h=Date:From:To:Cc:Subject:References:In-Reply-To;\r
+       b=SzOh1iNO/rXF5WAWJp8nM7Qdray93mjXGwn7ejihfDaK8Yoc60asG1Irozua4JM8H\r
+       cnp2f6QAZAyaf2LGfQd6E148n9UY5tdx4eikKmg7IMJ9bJdNQp6jWLsXMdFDmwglmd\r
+       GUXIC18ezAfSl9n0ucm3wjC+s8vixAou90PTSGtg=\r
+Date: Tue, 4 Feb 2014 08:11:42 -0800\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>\r
+Subject: Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general\r
+       refactoring\r
+Message-ID: <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
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+       protocol="application/pgp-signature"; boundary="lFtSGh4BwI5kpuz7"\r
+Content-Disposition: inline\r
+In-Reply-To: <m2fvnzp3uh.fsf@guru.guru-group.fi>\r
+OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8;\r
+       url=http://tremily.us/pubkey.txt\r
+User-Agent: Mutt/1.5.22 (2013-10-16)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20121106; t=1391530303;\r
+       bh=166rst9kQAmMYzKPjjqyiUyqxenCOVKonwV8mOu/79c=;\r
+       h=Received:Received:Received:Date:From:To:Subject:Message-ID:\r
+       MIME-Version:Content-Type;\r
+       b=AyIEppPDco5NNqqQiLGFUX2dZnFZUCJZJJhu7o+Txy6ADtpLR4iXtOEcYuerWcnSo\r
+       +Eigpu36/46TmmO2kcpfWTtjYNoxwvanLYwYM4Um0neNXeXRQYWXKj3kDAFy0Ut2m5\r
+       KzL9dHu2iNQydI03YUsT54LzmJIBlaqSPzZWff9Z4a5IsDuFW9R0xE6PCJj014H1K7\r
+       zG7PXnm14zkieiIx5LxUVOwZ5xpeYMSRoiup9lpOTACjxWbVjoBW/bL16Dy9akSlHx\r
+       3oo9/MS3Y6r7xBIAsn+clf8owbKVGabrQlsRtlAXXbRnad8BYGhQc61Kd85kMhSxNJ\r
+       kUClvbL4uir2A==\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 16:11:48 -0000\r
+\r
+\r
+--lFtSGh4BwI5kpuz7\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Tue, Feb 04, 2014 at 12:30:30PM +0200, Tomi Ollila wrote:\r
+> On Tue, Feb 04 2014, "W. Trevor King" wrote:\r
+> > On Mon, Feb 03, 2014 at 11:10:23PM +0200, Tomi Ollila wrote:\r
+> >>   File "devel/nmbug/nmbug-status", line 197, in _write_threads\r
+> >>     ).format(**message_display_data))\r
+> >>   File "/usr/lib64/python2.6/codecs.py", line 351, in write\r
+> >>     data, consumed =3D self.encode(object, self.errors)\r
+> >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in\r
+> >>   position 176: ordinal not in range(128)\r
+> >\r
+> > Hmm.  __future__'s unicode_literals should be giving us a Unicode\r
+> > target, so I'm not sure why we'd have trouble injecting Unicode.  This\r
+> > works fine for me on Python 2.7 and 3.3.  Maybe you just have a funky\r
+> > encoding?  =E2=80=A6\r
+>=20\r
+> LANG=3Den_US.UTF-8\r
+> all other LC_* variables en_US.UTF-8 except\r
+> LC_TIME=3Den_GB.utf8\r
+> LC_ALL empty (naturally)\r
+>=20\r
+> python -c 'import locale; print(locale.getpreferredencoding())'\r
+> UTF-8\r
+> python -c 'import sys; print(sys.getdefaultencoding())'\r
+> ascii\r
+\r
+That's very strange.  On Python 2.6.9, with the same encodings:\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.getdefaultencoding=\r
+()\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_strea=\r
+m)\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
+Thanks,\r
+Trevor\r
+\r
+--=20\r
+This email may be signed or encrypted with GnuPG (http://www.gnupg.org).\r
+For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\r
+\r
+--lFtSGh4BwI5kpuz7\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: OpenPGP digital signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2.0.22 (GNU/Linux)\r
+\r
+iQIcBAEBAgAGBQJS8RE7AAoJEKKfehoaNkbtIp8P+wYnJZsXqoGbGtfxvibDe2K1\r
+xsGvn2gcOk+NgQU6O1v58l/07jetldl0Q2uMVvGgXv7us3VS6ZqttJGfYdTXK2XH\r
+phJXsrB6C7O68Tff2kHXTwTdtJih5Ly7TiKrQdl+jVAwBZ5LNtHb0x/I0CVe5JpU\r
+Wu94fPePfufa+SlWSOGOnJqNMY4iXFUAkXNWMogTa3luVkUhShqFvSyacCZXr0ch\r
+rKlSMk82NgVk/zo2nNsrq9iEOiEtQCShkA72hU1tW3rS1W1xw2yXAa01GGj/yk4Y\r
+glrt0A8kQNP4/J8MGv+/19AXO1y4B/HWlOqWNJ/mJ/3pRtkCb4xJ4+5cwaBNZw3P\r
+3bXsKLkoTTReee2lAfpqBedP/bhBUleY2CzTihY49NeoCnOPNGDzj0NEoiaw0Krx\r
+cyI7pLPEQ2TxOEeewTqvgzUnBGNwuJdF4a13uYqMn+I9+8psnwYgCku0J6gjra8t\r
+9zsFYid3bB3uEfyoMJ1Jib3ret21/C1QQFbJnkeS1DxjJkGRmoIKaVCUvrE8mtTQ\r
+8lSoly8IG17tgOvANYzZkHSMM3cVFqG9Qd29xQp/zE7VRVi8ipi/fji8xHvyOWcf\r
+TYB00ToBpZCus8N6ggC229bU1QhnvVVDJmIpCzeMHKsqSlqClR1xqEZvEGQJktI8\r
+ZfUAM6Ca4l+VqtTjE0Cu\r
+=lj0k\r
+-----END PGP SIGNATURE-----\r
+\r
+--lFtSGh4BwI5kpuz7--\r