Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AAF1D431FD0 for ; Fri, 25 Nov 2011 01:05:54 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 1.7 X-Spam-Level: * X-Spam-Status: No, score=1.7 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aefDJ86tZvdY for ; Fri, 25 Nov 2011 01:05:54 -0800 (PST) Received: from mail-vw0-f53.google.com (mail-vw0-f53.google.com [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 00119431FB6 for ; Fri, 25 Nov 2011 01:05:53 -0800 (PST) Received: by vbbff1 with SMTP id ff1so3450456vbb.26 for ; Fri, 25 Nov 2011 01:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=message-id:content-type:mime-version:content-transfer-encoding:to :from:in-reply-to:references:subject:date; bh=/NpNJq19Pwnrlk7qj0RoyBHOAx8qUZ+QWuXsT7xMq9U=; b=A9PaD1Gx0nLjIyhSf5D8jfVthCLsd0YJaTXSvzX6PJX/NY1Q9gANQvSQ7YrJPXg7Mw 7n38OsmhM9czG+4zGNz287amk+RUmXQjSWRe/aeMSzJLuOmFTN1JijuXL3HVc95bZG5b htA2wIEzAZ7684LSY1TSG3loN06sLFgAFEk5c= Received: by 10.52.22.170 with SMTP id e10mr32746421vdf.75.1322211952207; Fri, 25 Nov 2011 01:05:52 -0800 (PST) Received: from localhost ([2001:6a0:5001:b:a288:b4ff:fe40:300c]) by mx.google.com with ESMTPS id eu4sm33387367vdc.8.2011.11.25.01.04.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Nov 2011 01:05:51 -0800 (PST) Message-ID: <4ecf5a6f.84b8340a.1db5.045f@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: David Bremner , Antoine Amarilli , notmuch@notmuchmail.org From: Patrick Totzke In-Reply-To: <8762i98pnh.fsf@zancas.localnet> References: <20111106221554.GA23240@clipper.ens.fr> <8762i98pnh.fsf@zancas.localnet> Subject: =?utf-8?q?Re=3A_python-notmuch_decoding_error_on_a_message?= Date: Fri, 25 Nov 2011 09:04:06 +0000 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2011 09:05:54 -0000 Silly question: how do i get Antoine's msg stup into notmuch? i tried using pythons mailbox lib to add this string to one of my mailboxes, which = works fine. but upon `notmuch new` I get something along the lines of "skipped non-mail= file $myfile".. back to the topic: I find it hichgly suprising that this decode fails because one can easily d= o sth like: ``` >>>'=3D?utf-8?B?M+ht?=3D =3D?utf-8?Q?e?=3D'.decode('UTF-8') u'=3D?utf-8?B?M+ht?=3D =3D?utf-8?Q?e?=3D' ``` So the actual string should not be the problem. Apparently, the string as its stored in the index is not plain ascii anymore, which it = was in the msg. I thought notmuch stores exacctly what it gets? Apart from this, I'd recommend replacing all decodes to unicode objects by a subroutine that does the following: If a global property notmuch.DEBUG is set to true: decode as is, which will raise these exceptions upon errors else: use .decode('UTF-8', errors=3D'ignore'). In case the mail is not malformed, it will not contain any non-ascii symbol= s whatsoever, so both ways should work. If you happen to deal with a malformed mail, you'= d get the problematic symbols omitted (beware of this when doing cryptostuff). what do you think? /p Quoting David Bremner (2011-11-24 16:13:22) >On Sun, 6 Nov 2011 23:15:54 +0100, Antoine Amarilli wrote: >> Hello, >> = >> The attached message makes python-notmuch crash when trying to access it= (see >> attached log). >> = >> I don't know if the encoding of Subject is valid or not, but it would pr= obably >> be better anyway to ignore decoding errors and return some approximation= of >> Subject instead of failing like this. >> = > >I get a set of critical errors about forgetting to call g_type_init. > >We actually call g_type_init in the CLI now, thanks to = > = > id:"1311625989-97755-1-git-send-email-aaronecay@gmail.com" > >but it sounds like this probably needs to be called either in libnotmuch >or in the bindings. = > >For what it is worth this message decodes fine in the CLI > >d >_______________________________________________ >notmuch mailing list >notmuch@notmuchmail.org >http://notmuchmail.org/mailman/listinfo/notmuch