]>
git.droids-corp.org - imapami.git/commit
utils: relax conversion to unicode
Some mails have incorrectly encoded headers, resulting in an exception
when decoding them. This can be reproduced manually:
>>> s='Vos deux avantages : 20% de r\xc3\xa9duction + Q1|\x051\xa5\xd9\xc9\x85\xa5\xcd\xbd\xb8\x80\xd0\xe1\xa0\x81\xbd\x99\x99\x95\xc9\xd1\x94\x80\x84'
>>> s.decode("utf-8")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
Be more relax and try to fix the encoding errors instead of throwing
an exception.
Signed-off-by: Olivier Matz <zer0@droids-corp.org>