This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author SegundoBob
Recipients Matthew Jacobi, SegundoBob, barry, medmunds, r.david.murray
Date 2018-03-27.18:43:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <58318807-1fe1-7cbd-f07d-b3809f197199@ieee.org>
In-reply-to <1522175407.81.0.467229070634.issue25257@psf.upfronthosting.co.za>
Content
Mike,

Thank you.

I moved to Python 3 some time ago.  I confirm that Python 3 does not
have the problem.  But I can't conveniently verify your workaround for
Python 2.

Regards,
Bob
bhossley@ieee.org

On 2018-03-27 11:30 AM, Mike Edmunds wrote:
> 
> Mike Edmunds <medmunds@gmail.com> 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 <report@bugs.python.org>
> <https://bugs.python.org/issue25257>
> _______________________________________
>
History
Date User Action Args
2018-03-27 18:43:40SegundoBobsetrecipients: + SegundoBob, barry, r.david.murray, Matthew Jacobi, medmunds
2018-03-27 18:43:40SegundoBoblinkissue25257 messages
2018-03-27 18:43:40SegundoBobcreate