Answer the question
In order to leave comments, you need to log in
I receive a letter using imaplib but returns not UTF-8 but UNICODE, how can I fix it?
I read a letter from the mail but instead of the usual UTF-8 comes UNICODE
raw_email_string = raw_email.decode()
email_message = email.message_from_string(raw_email_string, policy=policy.default)
if email_message.is_multipart():
for payload in email_message.get_payload():
body = payload.get_payload(decode=True).decode('UTF-8')
else:
body = email_message.get_payload(decode=True).decode('UTF-8')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question