incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arie...@apache.org
Subject svn commit: r1235677 - /incubator/ooo/trunk/main/scripting/source/pyprov/mailmerge.py
Date Wed, 25 Jan 2012 08:36:15 GMT
Author: arielch
Date: Wed Jan 25 08:36:15 2012
New Revision: 1235677

URL: http://svn.apache.org/viewvc?rev=1235677&view=rev
Log:
i118791 - Encode ReadableName in UTF-8 only when necessary

Modified:
    incubator/ooo/trunk/main/scripting/source/pyprov/mailmerge.py

Modified: incubator/ooo/trunk/main/scripting/source/pyprov/mailmerge.py
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scripting/source/pyprov/mailmerge.py?rev=1235677&r1=1235676&r2=1235677&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scripting/source/pyprov/mailmerge.py (original)
+++ incubator/ooo/trunk/main/scripting/source/pyprov/mailmerge.py Wed Jan 25 08:36:15 2012
@@ -205,8 +205,13 @@ class PyMailSMTPService(unohelper.Base, 
 			data = content.getTransferData(flavor)
 			msgattachment.set_payload(data)
 			Encoders.encode_base64(msgattachment)
+			fname = attachment.ReadableName
+			try:
+				fname.encode('ascii')
+			except:
+				fname = ('utf-8','',fname.encode('utf-8'))
 			msgattachment.add_header('Content-Disposition', 'attachment', \
-				filename=('utf-8','',attachment.ReadableName.encode('utf-8')))
+				filename=fname)
 			msg.attach(msgattachment)
 
 



Mime
View raw message