--- /dev/null
+Return-Path: <wuzzeb@wuzzeb.org>\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 9B905431FBC\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Jul 2013 19:36:17 -0700 (PDT)\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\r
+ tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 c3Rwa-DJySoA for <notmuch@notmuchmail.org>;\r
+ Wed, 24 Jul 2013 19:36:13 -0700 (PDT)\r
+Received: from smtp.rcn.com (smtp.rcn.com [69.168.97.78])\r
+ by olra.theworths.org (Postfix) with ESMTP id 7D74E431FB6\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Jul 2013 19:36:13 -0700 (PDT)\r
+X_CMAE_Category: 0,0 Undefined,Undefined\r
+X-CNFS-Analysis: v=2.1 cv=G7glTbU5 c=1 sm=0 tr=0\r
+ a=C2bPeGdon5f+QfTtoGFpIg==:117 a=C2bPeGdon5f+QfTtoGFpIg==:17\r
+ a=K-v-2zaBAAAA:8 a=gxDP-SbUGcMA:10 a=97V-WqMTq8EA:10\r
+ a=IkcTkHD0fZMA:10 a=3wHbS4G-AAAA:8 a=Qdy8_LB6nwUA:10\r
+ a=A1X0JdhQAAAA:8 a=Nn0Esa4SKUPhQueadGoA:9 a=0z3RHW59VqRJKvoH:21\r
+ a=LRJ8JICpaW-XGMMz:21 a=QEXdDO2ut3YA:10 a=Y6qChIQXU1wA:10\r
+X-CM-Score: 0\r
+X-Scanned-by: Cloudmark Authority Engine\r
+Authentication-Results: smtp01.rcn.cmh.synacor.com\r
+ header.from=wuzzeb@wuzzeb.org; sender-id=pass\r
+Authentication-Results: smtp01.rcn.cmh.synacor.com\r
+ smtp.mail=wuzzeb@wuzzeb.org; spf=pass; sender-id=pass\r
+Received-SPF: pass (smtp01.rcn.cmh.synacor.com: domain wuzzeb.org designates\r
+ 205.178.10.182 as permitted sender)\r
+Received: from [205.178.10.182] ([205.178.10.182:44046] helo=wuzzeb.org)\r
+ by smtp.rcn.com (envelope-from <wuzzeb@wuzzeb.org>)\r
+ (ecelerity 2.2.3.49 r(42060/42061)) with ESMTP\r
+ id 12/15-21927-C1F80F15; Wed, 24 Jul 2013 22:36:12 -0400\r
+Received: from wuzzeb by wuzzeb.org with local (Exim 4.80.1)\r
+ (envelope-from <wuzzeb@wuzzeb.org>)\r
+ id 1V2BPX-0007vw-Op; Wed, 24 Jul 2013 21:36:11 -0500\r
+From: =?utf-8?Q?John_Lenz?= <lenz@math.uic.edu>\r
+To: =?utf-8?Q?Tomi_Ollila?= <tomi.ollila@iki.fi>, <notmuch@notmuchmail.org>\r
+Subject: Re: cli: add --include-html option to notmuch show\r
+Message-ID: <notmuch-web-1374719771.1588310986@www.wuzzeb.org>\r
+In-reply-to: <m27ggj1x29.fsf@guru.guru-group.fi>\r
+References: <notmuch-web-1372724382.450184839@www.wuzzeb.org>\r
+ <m27ggj1x29.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Sender: <wuzzeb@wuzzeb.org>\r
+Date: Wed, 24 Jul 2013 21:36:11 -0500\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, 25 Jul 2013 02:36:17 -0000\r
+\r
+On Sun Jul 21 15:23 -0500 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Tue, Jul 02 2013, John Lenz <lenz@math.uic.edu> wrote:\r
+> \r
+> > For my client, the largest bottleneck for displaying large threads is\r
+> > exporting each html part individually since by default notmuch will not\r
+> > show the json parts. For large threads there can be quite a few parts and\r
+> > each must be exported and decoded one by one. Also, I then have to deal\r
+> > with all the crazy charsets which I can do through a library but is a\r
+> > pain.\r
+> \r
+> This looks like a useful option. I just wonder what effect does different\r
+> charsets do to the output (is text/html content output verbatim (with just\r
+> json/sexp escaping of '"' -characters). \r
+> \r
+> If you added test(s) showing what happens with different charsets\r
+> (like one message having 3 text/html parts, one us-ascii, one iso-8859-1\r
+> and one utf-8) that would make things clearer and (also) protect us from \r
+> regressions.\r
+> \r
+\r
+\r
+Here is a test I wrote. I tried to follow the other tests in formatting.\r
+Let me know if you want this as a single patch combined with the code\r
+to enable the option, I can resend it.\r
+\r
+\r
+\r
+#!/usr/bin/env bash\r
+test_description="include html parts when showing message"\r
+. ./test-lib.sh\r
+\r
+cat <<EOF > ${MAIL_DIR}/msg\r
+From: A <a@example.com>\r
+To: B <b@example.com>\r
+Subject: html message\r
+Date: Sat, 01 January 2000 00:00:00 +0000\r
+Message-ID: <htmlmessage>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/alternative; boundary="==-=="\r
+\r
+--==-==\r
+Content-Type: text/html; charset=UTF-8\r
+\r
+EOF\r
+# The Unicode fraction symbol 1/2 is U+00BD and is encoded\r
+# in UTF-8 as two bytes: octal 302 275\r
+echo $'<p>0.5 equals \302\275</p>' >> ${MAIL_DIR}/msg\r
+cat <<EOF >> ${MAIL_DIR}/msg\r
+\r
+--==-==\r
+Content-Type: text/html; charset=ISO-8859-1\r
+\r
+EOF\r
+# The ISO-8859-1 encoding of U+00BD is a single byte: octal 275\r
+echo $'<p>0.5 equals \275</p>' >> ${MAIL_DIR}/msg\r
+cat <<EOF >> ${MAIL_DIR}/msg\r
+\r
+--==-==\r
+Content-Type: text/plain; charset=UTF-8\r
+\r
+0.5 equals 1/2\r
+\r
+--==-==--\r
+EOF\r
+\r
+notmuch new > /dev/null\r
+\r
+\r
+cat <<EOF > EXPECTED.head\r
+[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",\r
+ "timestamp": 946684800,\r
+ "filename": "${MAIL_DIR}/msg",\r
+ "tags": ["inbox", "unread"],\r
+ "headers": { "Date": "Sat, 01 Jan 2000 00:00:00 +0000", "From": "A <a@example.com>",\r
+ "Subject": "html message", "To": "B <b@example.com>"},\r
+ "body": [{\r
+ "content-type": "multipart/alternative", "id": 1,\r
+EOF\r
+\r
+cat EXPECTED.head > EXPECTED.nohtml\r
+cat <<EOF >> EXPECTED.nohtml\r
+"content": [\r
+ { "id": 2, "content-charset": "UTF-8", "content-length": 21, "content-type": "text/html"},\r
+ { "id": 3, "content-charset": "ISO-8859-1", "content-length": 20, "content-type": "text/html"},\r
+ { "id": 4, "content-type": "text/plain", "content": "0.5 equals 1/2\\n"}\r
+]}]},[]]]]\r
+EOF\r
+\r
+# Both the UTF-8 and ISO-8859-1 part should have U+00BD\r
+cat EXPECTED.head > EXPECTED.withhtml\r
+cat <<EOF >> EXPECTED.withhtml\r
+"content": [\r
+ { "id": 2, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
+ { "id": 3, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
+ { "id": 4, "content-type": "text/plain", "content": "0.5 equals 1/2\\n"}\r
+]}]},[]]]]\r
+EOF\r
+\r
+test_begin_subtest "html parts excluded by default"\r
+notmuch show --format=json id:htmlmessage >OUTPUT\r
+test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.nohtml)"\r
+\r
+test_begin_subtest "html parts included"\r
+notmuch show --format=json --include-html id:htmlmessage > OUTPUT\r
+test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"\r
+\r
+test_done\r