From 1057fcec8ac1e8c77836b561746bdbc9b9de2725 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Sun, 27 Nov 2016 15:38:39 +0100 Subject: [PATCH] utils: fix exception with bad encoding Do not be strict when converting to unicode from an unknown encoding. This avoids an unrecoverable exception. Signed-off-by: Olivier Matz --- imapami/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imapami/utils.py b/imapami/utils.py index 4af970c..375910c 100644 --- a/imapami/utils.py +++ b/imapami/utils.py @@ -74,7 +74,7 @@ def headers_to_unicode(headers): # fallback to wrong decoding value, encoding = hdr, 'utf-8' if encoding is None: - value = unicode(value) + value = unicode(value, errors="replace") else: value = value.decode(encoding, errors="replace") unicode_headers[key] = value -- 2.39.5