--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 92B87429E59\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Aug 2013 06:52:25 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 0edm33RPyHoY for <notmuch@notmuchmail.org>;\r
+ Sun, 18 Aug 2013 06:52:17 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
+ [18.9.25.15])\r
+ by olra.theworths.org (Postfix) with ESMTP id 2667B431FDB\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Aug 2013 06:52:17 -0700 (PDT)\r
+X-AuditID: 1209190f-b7fa58e000000953-52-5210d1906fc0\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id C6.0B.02387.091D0125; Sun, 18 Aug 2013 09:52:16 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r7IDqESM015731; \r
+ Sun, 18 Aug 2013 09:52:14 -0400\r
+Received: from drake.dyndns.org\r
+ (static-burl-mse-71-161-109-98.ngn.east.myfairpoint.net\r
+ [71.161.109.98]) (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7IDqA6O023275\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Sun, 18 Aug 2013 09:52:13 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VB3Or-0001az-36; Sun, 18 Aug 2013 09:52:09 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] test: Canonicalize RFC 2047 encoding and charset\r
+Date: Sun, 18 Aug 2013 09:52:06 -0400\r
+Message-Id: <1376833926-6024-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFlrLIsWRmVeSWpSXmKPExsUixCmqrTvhokCQwfuzyhY3WrsZLZqmO1tc\r
+ vzmT2YHZ49b91+wez1bdYvbYcug9cwBzFJdNSmpOZllqkb5dAlfGod9CBT85KzYs/sHcwLiQ\r
+ o4uRk0NCwETi1JofbBC2mMSFe+uBbC4OIYF9jBKHb8xihnA2MkrsePoBKnOPSeLajt+sIC1C\r
+ AnMZJVoO5ILYbAIaEtv2L2cEsUUEpCV23p0NVsMs4CVx5f45ZhBbWMBR4sHh02DrWARUJVp7\r
+ tzGB2LwC9hI35lxihThDUaL72QS2CYy8CxgZVjHKpuRW6eYmZuYUpybrFicn5uWlFuma6OVm\r
+ luilppRuYgSHiiT/DsZvB5UOMQpwMCrx8Ea85g8SYk0sK67MPcQoycGkJMrbe1YgSIgvKT+l\r
+ MiOxOCO+qDQntfgQowQHs5II7865QDnelMTKqtSifJiUNAeLkjjvs6dnA4UE0hNLUrNTUwtS\r
+ i2CyMhwcShK86ReAGgWLUtNTK9Iyc0oQ0kwcnCDDeYCGbzsHMry4IDG3ODMdIn+KUVFKnHcJ\r
+ SLMASCKjNA+uFxbLrxjFgV4R5r0E0s4DTANw3a+ABjMBDZ50hhdkcEkiQkqqgdHk/K4Q9Zao\r
+ upvcb1wfL7rIv1fwsNlsW7UDN20mPzouvVnW2ekd18wVi8573/x5TsXG5ZWtl9yDXOU5Fb/U\r
+ L+VUHCm9c+T8h/nx3ZVFEjPWqnm1y2nfaLmi6HdqyYR5/W8X3FSwkSpmdRE3mvlvqk3omztf\r
+ PofW+5SbVtQEM556X9Q9vzjB4JQSS3FGoqEWc1FxIgDc4u+9wAIAAA==\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: Sun, 18 Aug 2013 13:52:26 -0000\r
+\r
+RFC 2047 states that the encoding and charset in an encoded word are\r
+case-insensitive, so force them to lower case in the reply test. This\r
+fixes an issue caused by GMime versions (somewhere between 2.6.10 and\r
+2.6.16), which changed the capitalization of the encoding.\r
+---\r
+ test/reply | 8 +++++---\r
+ 1 file changed, 5 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/test/reply b/test/reply\r
+index d4389cf..a078927 100755\r
+--- a/test/reply\r
++++ b/test/reply\r
+@@ -201,12 +201,14 @@ add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \\r
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \\r
+ '[body]="Encoding"'\r
+ \r
+-output=$(notmuch reply id:${gen_msg_id})\r
+-# Note that GMime changes from Q- to B-encoding\r
++# GMime happens to change from Q- to B-encoding. We canonicalize the\r
++# case of the encoding and charset because different versions of GMime\r
++# capitalize the encoding differently.\r
++output=$(notmuch reply id:${gen_msg_id} | sed 's/=?[^?]*?[bB]?/\L&/g')\r
+ test_expect_equal "$output" "\\r
+ From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
+ Subject: Re: =?iso-8859-1?b?4N/n?=\r
+-To: =?UTF-8?b?4piD?= <snowman@example.com>\r
++To: =?utf-8?b?4piD?= <snowman@example.com>\r
+ In-Reply-To: <${gen_msg_id}>\r
+ References: <${gen_msg_id}>\r
+ \r
+-- \r
+1.7.10.4\r
+\r