[PATCH] mail: encode long unicode lines in emails properly (issue5687)

Kevin Bullock kbullock+mercurial at ringworld.org
Mon Sep 25 16:12:16 EDT 2017


> 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?

It sounds like it would make more sense to fold this into your existing patch and send a V2.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list