Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale
authorDavid Bremner <david@tethera.net>
Tue, 11 Feb 2014 12:12:41 +0000 (08:12 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:54 +0000 (09:59 -0800)
a3/836b4afc673654be074f917ee4d95284c047cc [new file with mode: 0644]

diff --git a/a3/836b4afc673654be074f917ee4d95284c047cc b/a3/836b4afc673654be074f917ee4d95284c047cc
new file mode 100644 (file)
index 0000000..7d2f37b
--- /dev/null
@@ -0,0 +1,100 @@
+Return-Path: <david@tethera.net>\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 1A1D3431FBD\r
+       for <notmuch@notmuchmail.org>; Tue, 11 Feb 2014 04:12:58 -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 FAsdNfDbSF83 for <notmuch@notmuchmail.org>;\r
+       Tue, 11 Feb 2014 04:12:50 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+       (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A4844431FAF\r
+       for <notmuch@notmuchmail.org>; Tue, 11 Feb 2014 04:12:50 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+       (envelope-from <david@tethera.net>)\r
+       id 1WDCCj-0003Lm-MT; Tue, 11 Feb 2014 08:12:45 -0400\r
+Received: (nullmailer pid 27778 invoked by uid 1000); Tue, 11 Feb 2014\r
+       12:12:41 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's\r
+       locale\r
+In-Reply-To:\r
+ <deff072f78f4a7c5b0774e67a8f0517cc704725d.1392056624.git.wking@tremily.us>\r
+References: <cover.1392056624.git.wking@tremily.us>\r
+       <deff072f78f4a7c5b0774e67a8f0517cc704725d.1392056624.git.wking@tremily.us>\r
+User-Agent: Notmuch/0.17+53~g3e1d7f6 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Tue, 11 Feb 2014 08:12:41 -0400\r
+Message-ID: <87eh396e6e.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\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, 11 Feb 2014 12:12:58 -0000\r
+\r
+"W. Trevor King" <wking@tremily.us> writes:\r
+\r
+> Instead of always writing UTF-8, allow the user to configure the\r
+> output encoding using their locale.  This is useful for previewing\r
+> output in the terminal, for poor souls that don't use UTF-8 locales\r
+> ;).\r
+\r
+This (or some other patch in the series) seems to cause some problems on\r
+the production instance:\r
+\r
+remote: Traceback (most recent call last):\r
+remote:   File "/home/nmbug/tools/nmbug-status", line 336, in <module>\r
+remote:     page.write(database=db, views=config['views'])\r
+remote:   File "/home/nmbug/tools/nmbug-status", line 96, in write\r
+remote:     self._write_view(database=database, view=view, stream=stream)\r
+remote:   File "/home/nmbug/tools/nmbug-status", line 115, in _write_view\r
+remote:     self._write_threads(threads=threads, stream=stream)\r
+remote:   File "/home/nmbug/tools/nmbug-status", line 219, in _write_threads\r
+remote:     ).format(**message_display_data))\r
+remote:   File "/usr/lib/python2.6/codecs.py", line 351, in write\r
+remote:     data, consumed = self.encode(object, self.errors)\r
+remote: UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in position 219: ordinal not in range(128)\r
+\r
+possibly because of\r
+\r
+LANG=C\r
+LANGUAGE=\r
+LC_CTYPE="C"\r
+LC_NUMERIC="C"\r
+LC_TIME="C"\r
+LC_COLLATE="C"\r
+LC_MONETARY="C"\r
+LC_MESSAGES="C"\r
+LC_PAPER="C"\r
+LC_NAME="C"\r
+LC_ADDRESS="C"\r
+LC_TELEPHONE="C"\r
+LC_MEASUREMENT="C"\r
+LC_IDENTIFICATION="C"\r
+LC_ALL=C\r
+\r
+I think it's fine to _allow_ the user to configure the output encoding. I'm\r
+less sure about _requiring_ it.\r
+\r
+d\r