Mike Edmunds <[email protected]> added the comment:
Here's a workaround for Python 2.7:
```
class HeaderBugWorkaround(email.header.Header):
def encode(self, splitchars=' ', **kwargs): # only split on spaces, rather
than splitchars=';, '
return email.header.Header.encode(self, splitchars, **kwargs)
# and then...
msg['Subject'] = HeaderBugWorkaround(subject, 'utf-8', header_name='Subject')
```
(If you have the option, you're almost certainly better off moving to Python 3
for anything email related. But if you're maintaining code that has to be
Python 2.7 compatible, this might help.)
----------
nosy: +medmunds
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue25257>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com