--- /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 596C8429E2E\r
+ for <notmuch@notmuchmail.org>; Thu, 15 Aug 2013 10:27:56 -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 HNHXxwQLv4Fv for <notmuch@notmuchmail.org>;\r
+ Thu, 15 Aug 2013 10:27:51 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu\r
+ [18.7.68.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id B1BC2431FD4\r
+ for <notmuch@notmuchmail.org>; Thu, 15 Aug 2013 10:27:47 -0700 (PDT)\r
+X-AuditID: 12074422-b7ef78e000000935-0b-520d0f924aa4\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id D1.DC.02357.29F0D025; Thu, 15 Aug 2013 13:27:47 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r7FHRgqB004362; \r
+ Thu, 15 Aug 2013 13:27:42 -0400\r
+Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172])\r
+ (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 r7FHRe9E009073\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Thu, 15 Aug 2013 13:27:41 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VA1Kl-00053b-V5; Thu, 15 Aug 2013 13:27:39 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject:\r
+ [PATCH v2 1/3] reply: Test replying to messages with RFC 2047-encoded headers\r
+Date: Thu, 15 Aug 2013 13:27:36 -0400\r
+Message-Id: <1376587658-19202-2-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1376587658-19202-1-git-send-email-amdragon@mit.edu>\r
+References: <1376587658-19202-1-git-send-email-amdragon@mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hRV1p3MzxtkMLuP1eL6zZnMFm9WzmN1\r
+ YPI4/HUhi8ezVbeYA5iiuGxSUnMyy1KL9O0SuDL6u54xFmwWrPi8tYe9gfEtTxcjJ4eEgInE\r
+ 8bXTWSFsMYkL99azgdhCAvsYJd70pHUxcgHZGxkl1k1bwQzhHGGSODJ/GhuEM5dR4vvTkywg\r
+ LWwCGhLb9i9nBLFFBKQldt6dDTaWWcBK4vDVTWC2sECdxN3f3UA1HBwsAqoSt15LgYR5BRwk\r
+ Hux8zQJxhaJE97MJYFdwCjhKrJxwjxHiIgeJ/QvPsEHUC0qcnPmEBWQMs4C6xPp5QhCb5CWa\r
+ t85mnsAoNAtJ1SyEqllIqhYwMq9ilE3JrdLNTczMKU5N1i1OTszLSy3SNdXLzSzRS00p3cQI\r
+ Cmp2F6UdjD8PKh1iFOBgVOLhjWjjDhJiTSwrrsw9xCjJwaQkyruPjzdIiC8pP6UyI7E4I76o\r
+ NCe1+BCjBAezkgjv13s8QUK8KYmVValF+TApaQ4WJXHeZ0/PBgoJpCeWpGanphakFsFkZTg4\r
+ lCR4j4EMFSxKTU+tSMvMKUFIM3FwggznARp+E6SGt7ggMbc4Mx0if4pRUUqcdxlIQgAkkVGa\r
+ B9cLSzqvGMWBXhHm3QpSxQNMWHDdr4AGMwENdsjmAhlckoiQkmpgnFPp/ynTsrGHS8702Xmj\r
+ oKO7usQyp+xQ2jvh4vVtk60bXZ+aM/9gdPKbHBEfUvJyWYncXibfyLNvE/iT5zu16UcadSfe\r
+ 9QpZcvn2ucObOuYteDY7sH6ubMKEsOY/4XU/fsvE7p5/bX6f04zEg74rBOfGrqk/XXaIteLz\r
+ TA2Bli7Z7tn//Y9LKrEUZyQaajEXFScCACxap98VAwAA\r
+Cc: 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: Thu, 15 Aug 2013 17:27:56 -0000\r
+\r
+---\r
+ test/reply | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ 1 file changed, 56 insertions(+)\r
+\r
+diff --git a/test/reply b/test/reply\r
+index ee5d361..c877ffe 100755\r
+--- a/test/reply\r
++++ b/test/reply\r
+@@ -193,4 +193,60 @@ References: <${gen_msg_id}>\r
+ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:\r
+ > From guessing"\r
+ \r
++test_begin_subtest "Reply with RFC 2047-encoded headers"\r
++add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \\r
++ '[from]="=?utf-8?q?=e2=98=83?= <snowman@example.com>"' \\r
++ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \\r
++ '[body]="Encoding"'\r
++\r
++output=$(notmuch reply id:${gen_msg_id})\r
++test_expect_equal "$output" "\\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Subject: Re: àßç\r
++To: ☃ <snowman@example.com>\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0000, ☃ <snowman@example.com> wrote:\r
++> Encoding"\r
++\r
++test_begin_subtest "Reply with RFC 2047-encoded headers (JSON)"\r
++output=$(notmuch reply --format=json id:${gen_msg_id})\r
++test_expect_equal_json "$output" '\r
++{\r
++ "original": {\r
++ "body": [\r
++ {\r
++ "content": "Encoding\n",\r
++ "content-type": "text/plain",\r
++ "id": 1\r
++ }\r
++ ],\r
++ "date_relative": "2010-01-05",\r
++ "excluded": false,\r
++ "filename": "'${MAIL_DIR}'/msg-012",\r
++ "headers": {\r
++ "Date": "Tue, 05 Jan 2010 15:43:56 +0000",\r
++ "From": "\u2603 <snowman@example.com>",\r
++ "Subject": "\u00e0\u00df\u00e7",\r
++ "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"\r
++ },\r
++ "id": "'${gen_msg_id}'",\r
++ "match": false,\r
++ "tags": [\r
++ "inbox",\r
++ "unread"\r
++ ],\r
++ "timestamp": 1262706236\r
++ },\r
++ "reply-headers": {\r
++ "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
++ "In-reply-to": "<'${gen_msg_id}'>",\r
++ "References": " <'${gen_msg_id}'>",\r
++ "Subject": "Re: \u00e0\u00df\u00e7",\r
++ "To": "\u2603 <snowman@example.com>"\r
++ }\r
++}'\r
++\r
++\r
+ test_done\r
+-- \r
+1.7.10.4\r
+\r