1 Return-Path: <sojkam1@fel.cvut.cz>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 7A2C1431FAE
\r
6 for <notmuch@notmuchmail.org>; Thu, 23 Feb 2012 23:36:36 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id L1ZVK0O7IZbh for <notmuch@notmuchmail.org>;
\r
16 Thu, 23 Feb 2012 23:36:35 -0800 (PST)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 69351431FBC
\r
19 for <notmuch@notmuchmail.org>; Thu, 23 Feb 2012 23:36:35 -0800 (PST)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id AFFAB19F3399;
\r
22 Fri, 24 Feb 2012 08:36:34 +0100 (CET)
\r
23 X-Virus-Scanned: IMAP AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,
\r
27 with ESMTP id tYAF04f-RUnu; Fri, 24 Feb 2012 08:36:30 +0100 (CET)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id CEE1E19F339E;
\r
30 Fri, 24 Feb 2012 08:36:30 +0100 (CET)
\r
31 Received: from steelpick.2x.cz (cable-86-56-3-85.cust.telecolumbus.net
\r
32 [86.56.3.85]) (Authenticated sender: sojkam1)
\r
33 by imap.feld.cvut.cz (Postfix) with ESMTPSA id BA548660969;
\r
34 Fri, 24 Feb 2012 08:36:30 +0100 (CET)
\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.77)
\r
36 (envelope-from <sojkam1@fel.cvut.cz>)
\r
37 id 1S0phd-0001B1-Vb; Fri, 24 Feb 2012 08:36:29 +0100
\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 1/2] Convert non-UTF-8 parts to UTF-8 before indexing them
\r
41 Date: Fri, 24 Feb 2012 08:36:22 +0100
\r
42 Message-Id: <1330068983-4483-1-git-send-email-sojkam1@fel.cvut.cz>
\r
43 X-Mailer: git-send-email 1.7.9.1
\r
44 In-Reply-To: <1330043595-22054-1-git-send-email-sojkam1@fel.cvut.cz>
\r
45 References: <1330043595-22054-1-git-send-email-sojkam1@fel.cvut.cz>
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.13
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Fri, 24 Feb 2012 07:36:36 -0000
\r
60 This fixes a bug that didn't allow to search for non-ASCII words such
\r
61 parts. The code here was copied from show_text_part_content(), because
\r
62 the show command already does the needed conversion when showing the
\r
65 lib/index.cc | 15 +++++++++++++++
\r
66 1 files changed, 15 insertions(+), 0 deletions(-)
\r
68 diff --git a/lib/index.cc b/lib/index.cc
\r
69 index d8f8b2b..e377732 100644
\r
72 @@ -315,6 +315,7 @@ _index_mime_part (notmuch_message_t *message,
\r
73 GByteArray *byte_array;
\r
74 GMimeContentDisposition *disposition;
\r
76 + const char *charset;
\r
79 fprintf (stderr, "Warning: Not indexing empty mime part.\n");
\r
80 @@ -390,6 +391,20 @@ _index_mime_part (notmuch_message_t *message,
\r
81 g_mime_stream_filter_add (GMIME_STREAM_FILTER (filter),
\r
82 discard_uuencode_filter);
\r
84 + charset = g_mime_object_get_content_type_parameter (part, "charset");
\r
86 + GMimeFilter *charset_filter;
\r
87 + charset_filter = g_mime_filter_charset_new (charset, "UTF-8");
\r
88 + /* This result can be NULL for things like "unknown-8bit".
\r
89 + * Don't set a NULL filter as that makes GMime print
\r
90 + * annoying assertion-failure messages on stderr. */
\r
91 + if (charset_filter) {
\r
92 + g_mime_stream_filter_add (GMIME_STREAM_FILTER (filter),
\r
94 + g_object_unref (charset_filter);
\r
98 wrapper = g_mime_part_get_content_object (GMIME_PART (part));
\r
100 g_mime_data_wrapper_write_to_stream (wrapper, filter);
\r