--- /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 AAD6C429E25\r
+ for <notmuch@notmuchmail.org>; Mon, 12 Aug 2013 11:41:07 -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 tuMxsWOoBgma for <notmuch@notmuchmail.org>;\r
+ Mon, 12 Aug 2013 11:41:03 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
+ [18.7.68.35])\r
+ by olra.theworths.org (Postfix) with ESMTP id ECF3B431FBF\r
+ for <notmuch@notmuchmail.org>; Mon, 12 Aug 2013 11:40:53 -0700 (PDT)\r
+X-AuditID: 12074423-b7f168e00000095a-0a-52092c3576ef\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id C8.0F.02394.53C29025; Mon, 12 Aug 2013 14:40:53 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r7CIepiS006039; \r
+ Mon, 12 Aug 2013 14:40:51 -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 r7CIemOf003748\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Mon, 12 Aug 2013 14:40:50 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1V8x2u-0005yd-Mo; Mon, 12 Aug 2013 14:40:48 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject:\r
+ [PATCH 4/6] reply: Test replying to messages with RFC 2047-encoded headers\r
+Date: Mon, 12 Aug 2013 14:40:37 -0400\r
+Message-Id: <1376332839-22825-5-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1376332839-22825-1-git-send-email-amdragon@mit.edu>\r
+References: <1376332839-22825-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+NgFvrBIsWRmVeSWpSXmKPExsUixG6nrmuqwxlksGejhMX1mzOZHRg9nq26\r
+ xRzAGMVlk5Kak1mWWqRvl8CVcWHWd/aCTYIVU87vYWtgfMvTxcjJISFgIvFxxXw2CFtM4sK9\r
+ 9UA2F4eQwD5GiWt7TrOCJIQENjJKrHjvDZE4wiQx9WQDVNVcRol3zXeYQKrYBDQktu1fzghi\r
+ iwhIS+y8Oxuom4ODWUBN4k+XCkhYWKBS4sbJlWBDWQRUJXbsfgLWyivgIDHx9Q4miCsUJbqf\r
+ TQC7iFPAUeL+8nMsEEc4SGzc1cMIUS8ocXLmExaI8eoS6+cJgYSZBeQlmrfOZp7AKDQLSdUs\r
+ hKpZSKoWMDKvYpRNya3SzU3MzClOTdYtTk7My0st0jXTy80s0UtNKd3ECA5gF+UdjH8OKh1i\r
+ FOBgVOLhzfjIESTEmlhWXJl7iFGSg0lJlHeSJmeQEF9SfkplRmJxRnxRaU5q8SFGCQ5mJRHe\r
+ LaxAOd6UxMqq1KJ8mJQ0B4uSOO+zp2cDhQTSE0tSs1NTC1KLYLIyHBxKErzXtYAaBYtS01Mr\r
+ 0jJzShDSTBycIMN5gIafB6nhLS5IzC3OTIfIn2JUlBLnXQeSEABJZJTmwfXCEswrRnGgV4R5\r
+ L4NU8QCTE1z3K6DBTECDjZo5QAaXJCKkpBoYReear6v62Lxs5usLPwp+f++c6hmVrid5j99l\r
+ /osNx6YvKLvnE3VXerNEwrLp+0SWX/qS8d3z08H5F21+/lBg+2yUti1LaHugeO6P776/uR6s\r
+ 0L114sGE48dEdU8YXpJ19llrv+zbzucMVfEpgcoRTi+Dj7y9wOPpq/L0w5YM8dqP3pxFLW2K\r
+ LUosxRmJhlrMRcWJAH0/WU4LAwAA\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: Mon, 12 Aug 2013 18:41:07 -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..a85ebe5 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