fix(email): handle case where cstr returns text_type of str
chardet requires input to be bytes or bytesarray, but sometimes frappe.cstr() returns text_type of str without encoding it to utf-8 Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
parent
1bd0cfdfde
commit
4d48a2a032
1 changed files with 1 additions and 1 deletions
|
|
@ -480,7 +480,7 @@ class Email:
|
|||
"""Detect chartset."""
|
||||
charset = part.get_content_charset()
|
||||
if not charset:
|
||||
charset = chardet.detect(cstr(part))['encoding']
|
||||
charset = chardet.detect(safe_encode(cstr(part)))['encoding']
|
||||
|
||||
return charset
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue