summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-06-17 11:08:15 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-06-18 20:52:09 +0000
commit350994ffdc51787ecd51a8b7ce4e504c2432dd9d (patch)
tree1d0e0931c938928ce256225395750b2d274726de
parent595d667e64c1559b51ce407f6893b51014bdc11d (diff)
Resolves: fdo#55411 python 2 vs 3 str/bytes encoding issues
Change-Id: Ic1aac1609f3a1fcbd0af9a1c9ecc07a735c8785a (cherry picked from commit 06f22f5ae0eafe094b280f03c770eebdbb33d403) Reviewed-on: https://gerrit.libreoffice.org/4351 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-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 = {}