summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-06-17 11:08:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-06-17 13:50:32 +0100
commit06f22f5ae0eafe094b280f03c770eebdbb33d403 (patch)
tree4e75e5f0f7373dcd92278c7f6885c009f78acec3 /scripting
parent64aed8554510ec3c288ccc247701cf048df59860 (diff)
Resolves: fdo#55411 python 2 vs 3 str/bytes encoding issues
Change-Id: Ic1aac1609f3a1fcbd0af9a1c9ecc07a735c8785a
Diffstat (limited to 'scripting')
-rwxr-xr-xscripting/source/pyprov/mailmerge.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 18b476c26a17..f70f034c3569 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -239,11 +239,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
encode_base64(msgattachment)
fname = attachment.ReadableName
try:
- fname.encode('ascii')
+ msgattachment.add_header('Content-Disposition', 'attachment', \
+ filename=fname)
except:
- fname = ('utf-8','',fname.encode('utf-8'))
- msgattachment.add_header('Content-Disposition', 'attachment', \
- filename=fname)
+ msgattachment.add_header('Content-Disposition', 'attachment', \
+ filename=('utf-8','',fname))
+ if dbg:
+ print(("PyMailSMTPService attachmentheader: ", str(msgattachment)), file=dbgout)
+
msg.attach(msgattachment)
uniquer = {}