diff options
-rw-r--r-- | alot/db/message.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/alot/db/message.py b/alot/db/message.py index 74139315..f22db54b 100644 --- a/alot/db/message.py +++ b/alot/db/message.py @@ -149,16 +149,17 @@ class _MimeTree: def _fixup_charset(self): """ - If a text MIME part declares an invalid charset, replace it with UTF-8 + If a text MIME part declares an invalid or no charset, replace it + with UTF-8. """ charset = self._part.get_param('charset') - if charset is None: - return + if charset is not None: + try: + return codecs.lookup(charset) + except LookupError: + pass - try: - codecs.lookup(charset) - except LookupError: - self._part.set_param('charset', 'utf-8') + self._part.set_param('charset', 'utf-8') def render_str(self, alt_preference = None): if self.children is not None: |