[PATCH v4 3/4] nmbug-status: Encode output using the user's locale
authorW. Trevor King <wking@tremily.us>
Fri, 14 Feb 2014 16:48:54 +0000 (08:48 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:00:02 +0000 (10:00 -0800)
fa/a00435014e4d8a3b0ce1ea8fb4cb6c928b8e02 [new file with mode: 0644]

diff --git a/fa/a00435014e4d8a3b0ce1ea8fb4cb6c928b8e02 b/fa/a00435014e4d8a3b0ce1ea8fb4cb6c928b8e02
new file mode 100644 (file)
index 0000000..4691a3a
--- /dev/null
@@ -0,0 +1,111 @@
+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 1836C431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 14 Feb 2014 08:52:26 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\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 T+LxNMX5f3Fs for <notmuch@notmuchmail.org>;\r
+       Fri, 14 Feb 2014 08:52:20 -0800 (PST)\r
+Received: from qmta02.westchester.pa.mail.comcast.net\r
+       (qmta02.westchester.pa.mail.comcast.net [76.96.62.24])\r
+       by olra.theworths.org (Postfix) with ESMTP id 655ED431FBD\r
+       for <notmuch@notmuchmail.org>; Fri, 14 Feb 2014 08:52:13 -0800 (PST)\r
+Received: from omta15.westchester.pa.mail.comcast.net ([76.96.62.87])\r
+       by qmta02.westchester.pa.mail.comcast.net with comcast\r
+       id SGFo1n0011swQuc51GsDum; Fri, 14 Feb 2014 16:52:13 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta15.westchester.pa.mail.comcast.net with comcast\r
+       id SGqC1n00R152l3L3bGqDSb; Fri, 14 Feb 2014 16:50:13 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+       by odin.tremily.us (Postfix) with ESMTPS id 51CF6103A9A4;\r
+       Fri, 14 Feb 2014 08:50:12 -0800 (PST)\r
+Received: (nullmailer pid 18388 invoked by uid 1000);\r
+       Fri, 14 Feb 2014 16:48:57 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 3/4] nmbug-status: Encode output using the user's locale\r
+Date: Fri, 14 Feb 2014 08:48:54 -0800\r
+Message-Id:\r
+ <bb5b8633b53da73382fef09c7fa35bde95c0738b.1392395932.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1\r
+In-Reply-To: <cover.1392395932.git.wking@tremily.us>\r
+References: <cover.1392395932.git.wking@tremily.us>\r
+In-Reply-To: <cover.1392395932.git.wking@tremily.us>\r
+References: <cover.1392395932.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20121106; t=1392396733;\r
+       bh=LTXTVJ2Zy7/0quX/ecDWSzs3ksPc1HfCMrrf2wLtn3Y=;\r
+       h=Received:Received:Received:Received:From:To:Subject:Date:\r
+       Message-Id;\r
+       b=JVl6m2X/18QZZJ55lWhA2GvJ/h0gE3W91wfrjcYxobEtReqrDm/VuYSk5XknRu/aY\r
+       kzm1MloUq87mHwLrIWVFMiHvzCjGQdEVE2Lwf9SOb2LQ4EcqeWGxJznmoPE8RrR3jR\r
+       cbIh4+Yo5Y9HWiq5bsbfCD38xRy12LT/zcLkV654i9cHOIx6OBkn/o5Hh8g8OwlxSE\r
+       xdbHwOBKJ2ANkDPUep3W9Y7Oj6XzJTzHHMqf4cIPEZkUW1tO+G0Qu8lalK7wFAocl9\r
+       8l06dWyctkMJWSKSRyS5bRu4UcylGbZpv7ZQqxoKeccyYrOeIQxAgH23ssKh43/ejy\r
+       sR7Vs9FW8GhJg==\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: Fri, 14 Feb 2014 16:52:26 -0000\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
+ devel/nmbug/nmbug-status | 5 +++--\r
+ 1 file changed, 3 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index 018f191..c4532f1 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -90,7 +90,7 @@ class Page (object):\r
+                 byte_stream = sys.stdout.buffer\r
+             except AttributeError:  # Python 2\r
+                 byte_stream = sys.stdout\r
+-            stream = codecs.getwriter(encoding='UTF-8')(stream=byte_stream)\r
++            stream = codecs.getwriter(encoding=_ENCODING)(stream=byte_stream)\r
+         self._write_header(views=views, stream=stream)\r
+         for view in views:\r
+             self._write_view(database=database, view=view, stream=stream)\r
+@@ -249,7 +249,7 @@ _PAGES['html'] = HtmlPage(\r
+     header='''<!DOCTYPE html>\r
+ <html lang="en">\r
+ <head>\r
+-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
++  <meta http-equiv="Content-Type" content="text/html; charset={encoding}" />\r
+   <title>Notmuch Patches</title>\r
+   <style media="screen" type="text/css">\r
+     table {{\r
+@@ -293,6 +293,7 @@ For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>\r
+ </p>\r
+ <h3>Views</h3>\r
+ '''.format(date=datetime.datetime.utcnow().date(),\r
++           encoding=_ENCODING,\r
+            inter_message_padding='0.25em',\r
+            border_radius='0.5em'),\r
+     footer='</body>\n</html>\n',\r
+-- \r
+1.8.5.2.8.g0f6c0d1\r
+\r