From e7a540be87d298e52ec1b4365b2e679237b4b9a2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 4 Feb 2014 02:59:31 +1600 Subject: [PATCH] [PATCH 13/17] nmbug-status: Encode output using the user's locale --- ec/535d112978e971eaee92d181379cfba6f2c8c5 | 112 ++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 ec/535d112978e971eaee92d181379cfba6f2c8c5 diff --git a/ec/535d112978e971eaee92d181379cfba6f2c8c5 b/ec/535d112978e971eaee92d181379cfba6f2c8c5 new file mode 100644 index 000000000..7479dd8e4 --- /dev/null +++ b/ec/535d112978e971eaee92d181379cfba6f2c8c5 @@ -0,0 +1,112 @@ +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 DC815429E32 + for ; Mon, 3 Feb 2014 03:03:04 -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 TyR3dIbCYqve for ; + Mon, 3 Feb 2014 03:02:58 -0800 (PST) +Received: from qmta12.westchester.pa.mail.comcast.net + (qmta12.westchester.pa.mail.comcast.net [76.96.59.227]) + by olra.theworths.org (Postfix) with ESMTP id 64646429E48 + for ; Mon, 3 Feb 2014 03:02:44 -0800 (PST) +Received: from omta20.westchester.pa.mail.comcast.net ([76.96.62.71]) + by qmta12.westchester.pa.mail.comcast.net with comcast + id Mn2k1n0011YDfWL5Cn2kuP; Mon, 03 Feb 2014 11:02:44 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta20.westchester.pa.mail.comcast.net with comcast + id Mn0j1n00j152l3L3gn0kHT; Mon, 03 Feb 2014 11:00:44 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id 974FDFB4D5B; + Mon, 3 Feb 2014 03:00:43 -0800 (PST) +Received: (nullmailer pid 708 invoked by uid 1000); + Mon, 03 Feb 2014 10:59:42 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH 13/17] nmbug-status: Encode output using the user's locale +Date: Mon, 3 Feb 2014 02:59:31 -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=1391425364; + bh=7eoMlZwcCw4w7we9Iv9sn04rDARubSza7iwz/XbP94Y=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=XoC5q0jj/RIXYYqSJuuxT6w5+k3KfeA2Sk0fvd2U3fdtHhLu2zaON9j8mlJV/Jv4l + GQvIw1kEU/0FmUD4keCQJgmyNBiB9hCCmeuxSodd4AxVa/sOQMp1B9/GCgIeX7gU0+ + e2h7HR3cMnH4QAdyF22SarcnHpP+Fy7me9lpshl6xpMliG8Y+w8NzNbuPd24lsu+/Y + n91KJtw4DKlLj6bjUa+5/jOoZQdm5Sqsojzq08PieMZwz/1u9UQJHsf53x3ZmnwEdD + WBXfWKinj1ya0uF53+MBCfp77fx1SicJvcc668YriMfaytwRs/JwhbmoSb0E6KH4HR + kxFDkodPBYW+g== +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, 03 Feb 2014 11:03:05 -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 b67b86b..e86ea2a 100755 +--- a/devel/nmbug/nmbug-status ++++ b/devel/nmbug/nmbug-status +@@ -70,7 +70,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) +@@ -212,7 +212,7 @@ _PAGES['html'] = HtmlPage( + header=''' + + +- ++ + Notmuch Patches + + +@@ -220,7 +220,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