Update receive.py

This commit is contained in:
Ashish Shah 2019-08-21 12:01:06 +05:30 committed by GitHub
parent b8803a51ad
commit 4c7cbd6d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -481,10 +481,7 @@ class Email:
"""Detect chartset."""
charset = part.get_content_charset()
if not charset:
if six.PY2:
charset = chardet.detect(str(part))['encoding']
else:
charset = chardet.detect(frappe.safe_encode(str(part)))['encoding']
charset = chardet.detect(frappe.safe_encode(str(part)))['encoding']
return charset