plone.app.contentrules/fix32: Fix UnicodeEncodeError if portal from name contains Umlauts

Peter Holzer <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: plone.app.contentrules
Branch: refs/heads/fix32
Date: 2017-07-15T17:28:02+02:00
Author: Peter Holzer (agitator) <peter.holzer-2KzcThb1VtpWk0Htik3J/[email protected]>
Commit: https://github.com/plone/plone.app.contentrules/commit/5d69a880c611eda5ef7a7af0fe66088ded9dad1e

Fix UnicodeEncodeError if portal from name contains Umlauts

Files changed:
M CHANGES.rst
M plone/app/contentrules/actions/mail.py

diff --git a/CHANGES.rst b/CHANGES.rst
index b35566a..43e880c 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,7 +14,8 @@ New features:
 
 Bug fixes:
 
-- *add item here*
+- Fix UnicodeEncodeError if portal from name contains Umlauts
+  [agitator]
 
 
 4.0.16 (2017-05-23)
diff --git a/plone/app/contentrules/actions/mail.py b/plone/app/contentrules/actions/mail.py
index 601820b..320a76b 100644
--- a/plone/app/contentrules/actions/mail.py
+++ b/plone/app/contentrules/actions/mail.py
@@ -131,7 +131,7 @@ def __call__(self):
                 return False
 
             from_name = self.mail_settings.email_from_name.strip('"')
-            source = '"{0}" <{1}>'.format(from_name, from_address)
+            source = '"{0}" <{1}>'.format(from_name.encode('utf8'), from_address)
 
         recip_string = interpolator(self.element.recipients)
         if recip_string:  # check recipient is not None or empty string



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.