From f460556bfa6bd55df3cd4b2288524d63db284d7e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 13 Jul 2013 21:45:29 +0100 Subject: Related: fdo#66761 we want the bytes, not a str representation of them Change-Id: I3c268b0c51f7e1ddd2fa6588f40412a33f316b52 --- scripting/source/pyprov/mailmerge.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripting/source/pyprov') diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index 6fa486daf0a9..6ed046b107ff 100755 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -183,9 +183,11 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): textmsg['MIME-Version'] = '1.0' try: + #it's a string, get it as utf-8 bytes textbody = textbody.encode('utf-8') except: - textbody = str(textbody.value).encode('utf-8') + #it's a bytesequence, get raw bytes + textbody = textbody.value 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 textbody = textbody.decode('iso8859-1') -- cgit