diff --git a/README.rst b/README.rst index 15fec84..46bdb66 100644 --- a/README.rst +++ b/README.rst @@ -140,3 +140,4 @@ Thanks to | `thiebautdotdev `_ | `TpyoKnig `_ | `parchd-1 `_ + | `dojasoncom `_ diff --git a/imap_tools/message.py b/imap_tools/message.py index be417f2..c8e2201 100644 --- a/imap_tools/message.py +++ b/imap_tools/message.py @@ -178,7 +178,7 @@ def text(self) -> str: if part.get_content_maintype() == 'multipart': continue if part.get_content_type() in ('text/plain', 'text/'): - return part.get_payload(decode=True).decode('utf-8', 'ignore') + return part.get_payload(decode=True).decode(part.get_content_charset(failobj='utf-8'), 'ignore') return '' @property @@ -190,7 +190,7 @@ def html(self) -> str: if part.get_content_maintype() == 'multipart': continue if part.get_content_type() == 'text/html': - return part.get_payload(decode=True).decode('utf-8', 'ignore') + return part.get_payload(decode=True).decode(part.get_content_charset(failobj='utf-8'), 'ignore') return '' @property diff --git a/release_notes.rst b/release_notes.rst index 3ad3ea6..9d84268 100644 --- a/release_notes.rst +++ b/release_notes.rst @@ -1,3 +1,7 @@ +0.7.0 +===== +* decode MailMessage text and html using encoding, specified in email + 0.6.0 ===== diff --git a/setup.py b/setup.py index 4b66f3a..55bf5ad 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='imap_tools', - version='0.6.0', + version='0.7.0', packages=setuptools.find_packages(), url='https://github.com/ikvk/imap_tools', license='MIT',