'Regression for #12791 - Encode body correctly with other encodings
than utf-8'

def test_encoding(self):

    email = EmailMessage(u'Subject', u'Firstname    S\xfcrname    is    a    great    guy.', u'from@example.com', [u'other@example.com'])
    email.encoding = u'iso-8859-1'
    message = email.message()
    self.assertTrue(message.as_string().startswith(u'Content-Type:    text/plain;    charset="iso-8859-1"\nMIME-Version:    1.0\nContent-Transfer-Encoding:    quoted-printable\nSubject:    Subject\nFrom:    from@example.com\nTo:    other@example.com'))
    self.assertEqual(message.get_payload(), u'Firstname    S=FCrname    is    a    great    guy.')
    text_content = u'Firstname    S\xfcrname    is    a    great    guy.'
    html_content = u'<p>Firstname    S\xfcrname    is    a    <strong>great</strong>    guy.</p>'
    msg = EmailMultiAlternatives(u'Subject', text_content, u'from@example.com', [u'to@example.com'])
    msg.encoding = u'iso-8859-1'
    msg.attach_alternative(html_content, u'text/html')
    payload0 = msg.message().get_payload(0)
    self.assertMessageHasHeaders(payload0, set(((u'MIME-Version', u'1.0'), (u'Content-Type', u'text/plain;    charset="iso-8859-1"'), (u'Content-Transfer-Encoding', u'quoted-printable'))))
    self.assertTrue(payload0.as_bytes().endswith('\n\nFirstname    S=FCrname    is    a    great    guy.'))
    payload1 = msg.message().get_payload(1)
    self.assertMessageHasHeaders(payload1, set(((u'MIME-Version', u'1.0'), (u'Content-Type', u'text/html;    charset="iso-8859-1"'), (u'Content-Transfer-Encoding', u'quoted-printable'))))
    self.assertTrue(payload1.as_bytes().endswith('\n\n<p>Firstname    S=FCrname    is    a    <strong>great</strong>    guy.</p>'))
