[PATCH] mail: encode long unicode lines in emails properly (issue5687)
Yuya Nishihara
yuya at tcha.org
Tue Sep 26 12:58:58 UTC 2017
On Mon, 25 Sep 2017 15:12:16 -0500, Kevin Bullock wrote:
> > On Sep 25, 2017, at 10:39, Igor Ippolitov <iippolitov at gmail.com> wrote:
> > I gave it a thought and seems you are right. The function can be written down in a better (and shorter) way^
> >
> > >def mimetextqp(body, subtype, charset):
> > > '''Return MIME message.
> > > Quoted-printable transfer encoding will be used if necessary.
> > > '''
> > > cs = email.charset.Charset(charset)
> > > msg = email.Message.Message()
> > > msg.set_type('text/'+subtype)
> > >
> > > for line in body.splitlines():
> > > if len(line) > 950:
> > > cs.body_encoding = email.charset.QP
> > > break
> > >
> > > msg.set_payload(body,cs)
> > >
> > > return msg
> >
> > All tests are passed successfully with this change.
> > Should I submit this as a separate patch?
Nice.
> It sounds like it would make more sense to fold this into your existing patch and send a V2.
Yeah, please send a V2.
More information about the Mercurial-devel
mailing list