Kaydet (Commit) f460556b authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: fdo#66761 we want the bytes, not a str representation of them

Change-Id: I3c268b0c51f7e1ddd2fa6588f40412a33f316b52
üst 82937ce3
...@@ -183,9 +183,11 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): ...@@ -183,9 +183,11 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
textmsg['MIME-Version'] = '1.0' textmsg['MIME-Version'] = '1.0'
try: try:
#it's a string, get it as utf-8 bytes
textbody = textbody.encode('utf-8') textbody = textbody.encode('utf-8')
except: except:
textbody = str(textbody.value).encode('utf-8') #it's a bytesequence, get raw bytes
textbody = textbody.value
if sys.version >= '3': if sys.version >= '3':
#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w #http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
textbody = textbody.decode('iso8859-1') textbody = textbody.decode('iso8859-1')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment