Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / a2 / 7ef7ab83aa1686e4fe22d249676bb4ad80a5e3
1 Return-Path: <wking@tremily.us>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id C08A3431FBD\r
6         for <notmuch@notmuchmail.org>; Fri, 14 Feb 2014 08:50:21 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: 0\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
13         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
14         autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id XZtU8LgAnfeu for <notmuch@notmuchmail.org>;\r
18         Fri, 14 Feb 2014 08:50:14 -0800 (PST)\r
19 Received: from qmta04.westchester.pa.mail.comcast.net\r
20         (qmta04.westchester.pa.mail.comcast.net [76.96.62.40])\r
21         by olra.theworths.org (Postfix) with ESMTP id 79F2C431FBC\r
22         for <notmuch@notmuchmail.org>; Fri, 14 Feb 2014 08:50:14 -0800 (PST)\r
23 Received: from omta17.westchester.pa.mail.comcast.net ([76.96.62.89])\r
24         by qmta04.westchester.pa.mail.comcast.net with comcast\r
25         id SETK1n00A1vXlb854GqEZW; Fri, 14 Feb 2014 16:50:14 +0000\r
26 Received: from odin.tremily.us ([24.18.63.50])\r
27         by omta17.westchester.pa.mail.comcast.net with comcast\r
28         id SGqD1n005152l3L3dGqDh0; Fri, 14 Feb 2014 16:50:14 +0000\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
30         by odin.tremily.us (Postfix) with ESMTPS id C18EC103A9A6;\r
31         Fri, 14 Feb 2014 08:50:12 -0800 (PST)\r
32 Received: (nullmailer pid 18390 invoked by uid 1000);\r
33         Fri, 14 Feb 2014 16:48:57 -0000\r
34 From: "W. Trevor King" <wking@tremily.us>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH v4 4/4] nmbug-status: Hardcode UTF-8 instead of using the\r
37         user's locale\r
38 Date: Fri, 14 Feb 2014 08:48:55 -0800\r
39 Message-Id:\r
40  <2ccf8081e5195473199923f76e71cc33552b63df.1392395932.git.wking@tremily.us>\r
41 X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1\r
42 In-Reply-To: <cover.1392395932.git.wking@tremily.us>\r
43 References: <cover.1392395932.git.wking@tremily.us>\r
44 In-Reply-To: <cover.1392395932.git.wking@tremily.us>\r
45 References: <cover.1392395932.git.wking@tremily.us>\r
46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
47         s=q20121106; t=1392396614;\r
48         bh=hZxSG2hNFjKlPLJssd6MNC3pRSCBUYBw9bx42O44jD0=;\r
49         h=Received:Received:Received:Received:From:To:Subject:Date:\r
50         Message-Id;\r
51         b=P4e8PcZIjcDuRxQMvIcp9AZ2PvYtWJ1vsA+AQ/gfXNkWbh1FIb9N8fVDLQvQuawQG\r
52         03tzjQ7ysYejbqjnW7071OofLz/IUa4ptMTffAna9v9dLDTrBBxeuo1V7EL57yEDZi\r
53         dGcl1b7N+QEokrZBYjMaKowlsdwAhDv3bwkOPNEmhv6w1UH/Yv2T9RV/rPVQMmrokf\r
54         N9sEnZzOg2h7pzxT09VjAmV6VxkBtDudjFs5NZovTikgEgRdSyj/RA5ln0w3443Rwq\r
55         uGVMIcQZddidm95dVm42bDC3A08mUAMwOb8dGZUJMro0MmgYdbfufEWsz48yFvxJRk\r
56         xVWAwvkKtBIgw==\r
57 Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Fri, 14 Feb 2014 16:50:21 -0000\r
71 \r
72 David [1] and Tomi [2] both feel that the user's choice of LANG is not\r
73 explicit enough to have such a strong effect on nmbug-status.  For\r
74 example, cron jobs usually default to LANG=C, and that is going to\r
75 give you ASCII output:\r
76 \r
77   $ LANG=C python -c 'import locale; print(locale.getpreferredencoding())'\r
78   ANSI_X3.4-1968\r
79 \r
80 Trying to print Unicode author names (and other strings) in that\r
81 encoding would crash nmbug-status with a UnicodeEncodeError.  To avoid\r
82 that, this patch hardcodes UTF-8, which can handle generic Unicode,\r
83 and is the preferred encoding (regardless of LANG settings) for\r
84 everyone who has chimed in on the list so far.  I'd prefer trusting\r
85 LANG, but in the absence of any users that prefer non-UTF-8 encodings\r
86 I'm fine with this approach.\r
87 \r
88 While we could achieve the same effect on the output content by\r
89 dropping the previous patch (nmbug-status: Encode output using the\r
90 user's locale), Tomi also wanted UTF-8 hardcoded as the config-file\r
91 encoding [2].  Keeping the output encoding patch and then adding this\r
92 to hardcode both the config-file and output encodings at once seems\r
93 the easiest route, now that fd29d3f (nmbug-status: Decode Popen output\r
94 using the user's locale, 2014-02-10) has landed in master.\r
95 \r
96 [1]: id="877g8z4v4x.fsf@zancas.localnet"\r
97      http://article.gmane.org/gmane.mail.notmuch.general/17202\r
98 [2]: id="m2vbwj79lu.fsf@guru.guru-group.fi"\r
99      http://article.gmane.org/gmane.mail.notmuch.general/17209\r
100 ---\r
101  devel/nmbug/nmbug-status | 3 +--\r
102  1 file changed, 1 insertion(+), 2 deletions(-)\r
103 \r
104 diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
105 index c4532f1..ef7169a 100755\r
106 --- a/devel/nmbug/nmbug-status\r
107 +++ b/devel/nmbug/nmbug-status\r
108 @@ -13,7 +13,6 @@ import codecs\r
109  import collections\r
110  import datetime\r
111  import email.utils\r
112 -import locale\r
113  try:  # Python 3\r
114      from urllib.parse import quote\r
115  except ImportError:  # Python 2\r
116 @@ -27,7 +26,7 @@ import subprocess\r
117  import xml.sax.saxutils\r
118  \r
119  \r
120 -_ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding()\r
121 +_ENCODING = 'UTF-8'\r
122  _PAGES = {}\r
123  \r
124  \r
125 -- \r
126 1.8.5.2.8.g0f6c0d1\r
127 \r