unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Patrick Totzke <patricktotzke@googlemail.com>
To: David Bremner <david@tethera.net>,
	Antoine Amarilli <antoine.amarilli@ens.fr>,
	notmuch@notmuchmail.org
Subject: Re: python-notmuch decoding error on a message
Date: Fri, 25 Nov 2011 09:04:06 +0000	[thread overview]
Message-ID: <4ecf5a6f.84b8340a.1db5.045f@mx.google.com> (raw)
In-Reply-To: <8762i98pnh.fsf@zancas.localnet>

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 do sth like:

```
>>>'=?utf-8?B?M+ht?= =?utf-8?Q?e?='.decode('UTF-8')
u'=?utf-8?B?M+ht?= =?utf-8?Q?e?='
```
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='ignore').

In case the mail is not malformed, it will not contain any non-ascii symbols 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 <antoine.amarilli@ens.fr> 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 probably
>> 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

  reply	other threads:[~2011-11-25  9:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-06 22:16 python-notmuch decoding error on a message Antoine Amarilli
2011-11-24 16:13 ` David Bremner
2011-11-25  9:04   ` Patrick Totzke [this message]
2011-11-25 12:15     ` David Bremner
2011-12-01 21:30   ` Sebastian Spaeth
2012-11-06  1:50 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ecf5a6f.84b8340a.1db5.045f@mx.google.com \
    --to=patricktotzke@googlemail.com \
    --cc=antoine.amarilli@ens.fr \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).