--- /dev/null
+Return-Path: <too@guru-group.fi>\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 CE77C431FC0\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 12:06:30 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 TxSe+LBDb2Rv for <notmuch@notmuchmail.org>;\r
+ Sun, 18 Nov 2012 12:06:29 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id C5E53431FB6\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 12:06:29 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id AE684100148; Sun, 18 Nov 2012 22:06:27 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject:\r
+ [PATCH 1/2] test/emacs: test saving of attachment containing 8bit octets\r
+Date: Sun, 18 Nov 2012 22:06:24 +0200\r
+Message-Id: <1353269185-23210-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <id:87txsm23hs.fsf@betacantrips.com>\r
+References: <id:87txsm23hs.fsf@betacantrips.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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: Sun, 18 Nov 2012 20:06:31 -0000\r
+\r
+This test catches the case 8bit octets in an attachment gets converted\r
+or lost when saving attachment to the file.\r
+This test is marked known broken.\r
+---\r
+ test/emacs | 27 +++++++++++++++++++++++++++\r
+ 1 file changed, 27 insertions(+)\r
+\r
+diff --git a/test/emacs b/test/emacs\r
+index 77265b0..c8db7d0 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -516,6 +516,33 @@ test_emacs '(let ((standard-input "\"attachment2.gz\""))\r
+ (notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5))'\r
+ test_expect_equal_file attachment2.gz "$EXPECTED/attachment"\r
+ \r
++test_begin_subtest "Save 8bit attachment from within emacs using notmuch-show-save-attachments"\r
++test_subtest_known_broken\r
++\r
++add_message '[subject]="Attachment with 8bit chars"' \\r
++ '[header]="MIME-Version: 1.0"' \\r
++ '[content-type]="multipart/mixed; boundary=\"abcd\""' \\r
++ '[body]="--abcd\r
++Content-Type: text/plain\r
++\r
++Attachment follows:\r
++\r
++--abcd\r
++Content-Type: application/octet-stream; name=\"sample\"\r
++Content-Transfer-Encoding: 8bit\r
++Content-Disposition: attachment; filename=\"sample\"\r
++\r
++“¡ Hey ! It compiles ¡ Ship it !”\r
++\r
++--abcd--\r
++"'\r
++test_emacs '(notmuch-show "id:'"${gen_msg_id}"'")\r
++ (delete-file "OUTPUT")\r
++ (let ((standard-input "\"OUTPUT\""))\r
++ (notmuch-show-save-attachments))'\r
++\r
++test_expect_equal "$(cat OUTPUT)" '“¡ Hey ! It compiles ¡ Ship it !”'\r
++\r
+ test_begin_subtest "View raw message within emacs"\r
+ test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")\r
+ (notmuch-show-view-raw-message)\r
+-- \r
+1.8.0\r
+\r