Resolves: fdo#55411 python 2 vs 3 str/bytes encoding issues
Change-Id: Ic1aac1609f3a1fcbd0af9a1c9ecc07a735c8785a
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 18b476c..f70f034 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 = {}