diff options
-rwxr-xr-x | deployment/mgagit/templates/git_multimail.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/deployment/mgagit/templates/git_multimail.py b/deployment/mgagit/templates/git_multimail.py index f1739b43..4b5f6f13 100755 --- a/deployment/mgagit/templates/git_multimail.py +++ b/deployment/mgagit/templates/git_multimail.py @@ -352,6 +352,15 @@ def addr_header_encode(text, header_name=None): """Encode and line-wrap the value of an email header field containing email addresses.""" + # (cg) It seems that From: names (or perhaps Subject: headers) that contain + # a UTF8 character before the first space confuse the older python Header() + # class. This does not appear to be needed in newer python versions, but + # this little workaround seems to help on 2.7.1 on valstar mga1. + try: + unicode(text) + except UnicodeDecodeError: + text = text.decode('utf-8') + return Header( ', '.join( formataddr((header_encode(name), emailaddr)) |