From 66a125ef141bdda296a81ead0fb3f66477b2e099 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Mon, 3 Aug 2015 17:16:23 -0400 Subject: [PATCH] simplify mime creation; set payload charset --- edward | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/edward b/edward index 673e4dc..2f659da 100755 --- a/edward +++ b/edward @@ -1146,15 +1146,8 @@ def generate_encrypted_mime (plaintext, email_to, email_subject, encrypt_to_key, if (encrypt_to_key != None): - # quoted printable encoding lets most ascii characters look normal - # before the mime message is decoded. - char_set = email.charset.Charset("utf-8") - char_set.body_encoding = email.charset.QP - - # MIMEText doesn't allow setting the text encoding - # so we use MIMENonMultipart. - plaintext_mime = MIMENonMultipart('text', 'plain') - plaintext_mime.set_payload(plaintext, charset=char_set) + plaintext_mime = MIMEText(plaintext) + plaintext_mime.set_charset('utf-8') encrypted_text = encrypt_sign_message(plaintext_mime.as_string(), encrypt_to_key, @@ -1180,6 +1173,7 @@ def generate_encrypted_mime (plaintext, email_to, email_subject, encrypt_to_key, else: message_mime = MIMEText(plaintext) + message_mime.set_charset('utf-8') message_mime['To'] = email_to message_mime['Subject'] = email_subject -- 2.25.1