From af3963d605a67a30074c3cd8baca355a7dfdec05 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 26 Feb 2018 16:14:50 -0800 Subject: possibly fix opening emails encoded as non-ascii/non-unicode --- alot/db/message.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'alot/db/message.py') diff --git a/alot/db/message.py b/alot/db/message.py index 4c4af99b..2e1fef54 100644 --- a/alot/db/message.py +++ b/alot/db/message.py @@ -10,7 +10,8 @@ from datetime import datetime from notmuch import NullPointerError -from .utils import extract_body, message_from_file +from . import utils +from .utils import extract_body from .utils import decode_header from .attachment import Attachment from .. import helper @@ -101,8 +102,8 @@ class Message(object): "Message file is no longer accessible:\n%s" % path if not self._email: try: - with open(path) as f: - self._email = message_from_file(f) + with open(path, 'rb') as f: + self._email = utils.message_from_bytes(f.read()) except IOError: self._email = email.message_from_string(warning) return self._email -- cgit v1.2.3