--- /dev/null
+Return-Path: <jani@nikula.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 01FDC431FAE\r
+ for <notmuch@notmuchmail.org>; Fri, 9 Aug 2013 11:05:02 -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 E3VTaFpjBnVX for <notmuch@notmuchmail.org>;\r
+ Fri, 9 Aug 2013 11:04:55 -0700 (PDT)\r
+Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com\r
+ [74.125.82.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 97C14431FAF for <notmuch@notmuchmail.org>; Fri, 9 Aug 2013 11:04:55 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f51.google.com with SMTP id a12so3751476wgh.18\r
+ for <notmuch@notmuchmail.org>; Fri, 09 Aug 2013 11:04:53 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=x-gm-message-state:from:to:cc:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=wVJH0hBU0o7KIS4xCuQtlu86kQRdsBtdrVvuKFWPb98=;\r
+ b=Uwdn9o1JBvp54yZlu0crPDXm4E/MNRiRYkG+eEdVcN12X1qPIaqZVPARgi5TynkgAy\r
+ tIRASlseZI0wdDLBUJMYMwm/Pu9Wd6AwDRnuORLhLqjXUlE1hpdWirfUz38chTL0RhvO\r
+ 22ACl6lgzYPPtu2tULJjCzpITFgiQN3++WM3Pg2qRtZNufX8kOyU3dLgD0OhohberzrK\r
+ 4/iyip30MkBlF1vPiM8Nvw3OQKxQt94HzZc7ct4yqO3vTTSDtI6jmn0TNuxXYJUYGiKR\r
+ WP5Jx+eGPN+qHo0+DvmXQkKwAs7Q4rbqfKBdH3qgh1AAZuWSYE9MuUw8LcY5laD3Dezp\r
+ e3xA==\r
+X-Gm-Message-State:\r
+ ALoCoQk9LtRNFda4ARjcIU/o5u7/vu/p+jwnRM/b/NNvgttilQ1SP/BEfWlPpO5z3DMsHZ8PjKDE\r
+X-Received: by 10.180.206.97 with SMTP id ln1mr933005wic.39.1376071493192;\r
+ Fri, 09 Aug 2013 11:04:53 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+ by mx.google.com with ESMTPSA id li9sm4109085wic.2.2013.08.09.11.04.51\r
+ for <multiple recipients>\r
+ (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+ Fri, 09 Aug 2013 11:04:52 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: stedfast@comcast.net, Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+Subject: Re: UTF-8 in mail headers (namely FROM) sent by bugzilla\r
+In-Reply-To: <289881190.1977918.1376058260231.JavaMail.root@sz0152a.westchester.pa.mail.comcast.net>\r
+References: <289881190.1977918.1376058260231.JavaMail.root@sz0152a.westchester.pa.mail.comcast.net>\r
+User-Agent: Notmuch/0.15.2+177~gb1ba76c (http://notmuchmail.org) Emacs/23.2.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 09 Aug 2013 20:04:47 +0200\r
+Message-ID: <87bo56viyo.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: Eric Abrahamsen <eric@ericabrahamsen.net>,\r
+ Notmuch Mail <notmuch@notmuchmail.org>\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: Fri, 09 Aug 2013 18:05:02 -0000\r
+\r
+On Fri, 09 Aug 2013, stedfast@comcast.net wrote:\r
+> Hi guys, \r
+>\r
+> ( I'm the author of GMime for those that don't know) \r
+>\r
+> I just came across the notmuch thread (with the referenced Subject)\r
+> but unfortunately am not subscribed to the mailing list and so am\r
+> unable to reply to the list (hopefully no one minds me emailing them\r
+> directly!). I wanted to reach out and offer a possible solution to the\r
+> problem being discussed.\r
+\r
+Thanks for your mail; hopefully you don't mind me replying to the list!\r
+\r
+> Passing the GMIME_ENABLE_RFC2047_WORKAROUNDS flag to g_mime_init()\r
+> *should* solve the decoding problem mentioned in the thread. This flag\r
+> should be safe to pass into g_mime_init() without any bad side effects\r
+> and my unit tests do test that code-path.\r
+\r
+Many thanks, this solves my issue with the subject lines.\r
+\r
+This is the quick patch I tried:\r
+\r
+diff --git a/notmuch.c b/notmuch.c\r
+index 78d29a8..7300c21 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -264,7 +264,7 @@ main (int argc, char *argv[])\r
+ \r
+ local = talloc_new (NULL);\r
+ \r
+- g_mime_init (0);\r
++ g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);\r
+ #if !GLIB_CHECK_VERSION(2, 35, 1)\r
+ g_type_init ();\r
+ #endif\r
+\r
+We'll need to look into using this in the lib too.\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+> I took a look at gmime-filter-headers.[c,h] as well and I suspect that\r
+> it was written back when GMime brokenly did not guarantee UTF-8\r
+> decoded strings from functions like g_mime_message_get_subject() and\r
+> the like. This was fixed a while back. From a quick grep of the\r
+> ChangeLog it looks like this was probably fixed in 2.5.9 or so (but\r
+> possibly as late as 2.6.3 as there were some other charset rfc2047\r
+> decoder fixes around then).\r
+>\r
+> I know for sure that the 2.4.x series didn't guarantee UTF-8-safe\r
+> strings, but it's been the goal of 2.6.x to make that guarantee (minus\r
+> any bugs that may exist, but if you find any cases of that, let me\r
+> know!)\r
+>\r
+> (Note: raw header values from g_mime_object_get_header() are not\r
+> guaranteed to be UTF-8 but if you call\r
+> g_mime_utils_header_decode_text/phrase() on them, the results are\r
+> guaranteed to be valid UTF-8)\r
+>\r
+> Hope that helps, \r
+>\r
+> Jeff \r