Problem with ImapLib and subject in French

Valentin Mercier merciervspam at gmail.com
Mon Jun 18 07:31:12 EDT 2012


Hi,

I'm trying to search some mails with SUBJECT criteria, but the problem is
the encoding, I'm trying to search french terms (impalib and python V2.7)

I've tried few things, but I think the encoding is the problem, in my mail
header I have something like this:

 =?iso-8859-1?Q?Job:_"Full_Backup_Les_Gr=E8ves_du_Lac")_?=

I need to search unseen mail with the FROM and the SUBJECT criteria. I take
those two in parameters in my python script and the second contain special
caracters like é or è, so I encode the string like this:

             temp = header_encode(unicode('Les grèves','utf-8'),
charset='iso-8859-1')

And the string is exactly the same as the header:

=?iso-8859-1?q?Full_Backup_Les_Gr=E8ves?=

But the search function doesn't find my email, and I don't know why, even
if I try with the entire string of the subject.

I hope you can understand my question and my english (I'm from switzerland
so my english is not so good) and you can answer me.

Thanks in advance and best regards

Valentin Mercier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120618/b4bd1601/attachment.html>


More information about the Python-list mailing list