From cf49392c4f9965bd21962525249ec0947d7fb8bd Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 11 Feb 2014 10:40:35 +1600 Subject: [PATCH] [PATCH v2 14/20] nmbug-status: Encode output using the user's locale --- ff/8fb5bd119e1494ced1a0aeb13431c2bd68bbd0 | 113 ++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 ff/8fb5bd119e1494ced1a0aeb13431c2bd68bbd0 diff --git a/ff/8fb5bd119e1494ced1a0aeb13431c2bd68bbd0 b/ff/8fb5bd119e1494ced1a0aeb13431c2bd68bbd0 new file mode 100644 index 000000000..ce10a229a --- /dev/null +++ b/ff/8fb5bd119e1494ced1a0aeb13431c2bd68bbd0 @@ -0,0 +1,113 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 18249431FDF + for ; Mon, 10 Feb 2014 10:44:52 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id UXcK+5cYLrUB for ; + Mon, 10 Feb 2014 10:44:47 -0800 (PST) +Received: from qmta15.westchester.pa.mail.comcast.net + (qmta15.westchester.pa.mail.comcast.net [76.96.59.228]) + by olra.theworths.org (Postfix) with ESMTP id 648A4429E31 + for ; Mon, 10 Feb 2014 10:44:00 -0800 (PST) +Received: from omta14.westchester.pa.mail.comcast.net ([76.96.62.60]) + by qmta15.westchester.pa.mail.comcast.net with comcast + id QhLQ1n0081HzFnQ5Fik0gy; Mon, 10 Feb 2014 18:44:00 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta14.westchester.pa.mail.comcast.net with comcast + id Qihy1n00Y152l3L3aihzVh; Mon, 10 Feb 2014 18:42:00 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id 5D79510167BD; + Mon, 10 Feb 2014 10:41:58 -0800 (PST) +Received: (nullmailer pid 1274 invoked by uid 1000); + Mon, 10 Feb 2014 18:40:45 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale +Date: Mon, 10 Feb 2014 10:40:35 -0800 +Message-Id: + +X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1 +In-Reply-To: +References: +In-Reply-To: +References: +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20121106; t=1392057840; + bh=LnRJyXSjLCoerteKJpW+gfOt5wfR0V949s2BodEGwVs=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=rCKud1oSzCuyqSGR9QXJPVtmAxWzj4pztztirZgOOiQLLd6b3iEGgLnmUf5DYMwu6 + LzW9EL89TfNRopeIq00hh9FZGJ0dO+YhVQWV9ip//siEKvBUpxU45vmmknQDInPNOC + s0CLd9p9Qrb8AWT3r2Bk0ybVle7X1JqNDyViAkPJ0LZMEispK0L4Awi1bZI69rvVbl + WDCiQK7r2CzqyowShZsxruPcOqqTuwuQb0UgqAPpEapca9Hh87N48ehWsV4duyogiP + LhqQB+IVA6h9oOuA/2PRreL78ucQGwC3Mz7KU+tvboB/anBF3Sw/8GKrrYW8haskGJ + J1jpOa/Xfx1sA== +Cc: Tomi Ollila +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 10 Feb 2014 18:44:52 -0000 + +Instead of always writing UTF-8, allow the user to configure the +output encoding using their locale. This is useful for previewing +output in the terminal, for poor souls that don't use UTF-8 locales +;). +--- + devel/nmbug/nmbug-status | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status +index 873a46a..040baf0 100755 +--- a/devel/nmbug/nmbug-status ++++ b/devel/nmbug/nmbug-status +@@ -88,7 +88,7 @@ class Page (object): + byte_stream = sys.stdout.buffer + except AttributeError: # Python 2 + byte_stream = sys.stdout +- stream = codecs.getwriter(encoding='UTF-8')(stream=byte_stream) ++ stream = codecs.getwriter(encoding=_ENCODING)(stream=byte_stream) + self._write_header(views=views, stream=stream) + for view in views: + self._write_view(database=database, view=view, stream=stream) +@@ -230,7 +230,7 @@ _PAGES['html'] = HtmlPage( + header=''' + + +- ++ + Notmuch Patches + + +@@ -238,7 +238,8 @@ _PAGES['html'] = HtmlPage( + Generated: {date}
+ For more infomation see nmbug +

Views

+-'''.format(date=datetime.datetime.utcnow().date()), ++'''.format(date=datetime.datetime.utcnow().date(), ++ encoding=_ENCODING), + footer='\n\n', + ) + +-- +1.8.5.2.8.g0f6c0d1 + -- 2.26.2