summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-13 21:45:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-14 14:04:03 +0100
commitf460556bfa6bd55df3cd4b2288524d63db284d7e (patch)
tree231e527e2a3e700eaeaa4286f73bc489d8778438 /scripting
parent82937ce3d7bc2382c4da22365d1245c9f7db178c (diff)
Related: fdo#66761 we want the bytes, not a str representation of them
Change-Id: I3c268b0c51f7e1ddd2fa6588f40412a33f316b52
Diffstat (limited to 'scripting')
-rwxr-xr-xscripting/source/pyprov/mailmerge.py4
1 files changed, 3 insertions, 1 deletions
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')