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

def test_encoding(self):

    email = EmailMessage('Subject', 'Firstname    S\xc3\xbcrname    is    a    great    guy.', 'from@example.com', ['other@example.com'])
    email.encoding = 'iso-8859-1'
    message = email.message()
    self.assertTrue(message.as_string().startswith('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(), 'Firstname    S=FCrname    is    a    great    guy.')
    text_content = 'Firstname    S\xc3\xbcrname    is    a    great    guy.'
    html_content = '<p>Firstname    S\xc3\xbcrname    is    a    <strong>great</strong>    guy.</p>'
    msg = EmailMultiAlternatives('Subject', text_content, 'from@example.com', ['to@example.com'])
    msg.encoding = 'iso-8859-1'
    msg.attach_alternative(html_content, 'text/html')
    self.assertEqual(msg.message().get_payload(0).as_string(), 'Content-Type:    text/plain;    charset="iso-8859-1"\nMIME-Version:    1.0\nContent-Transfer-Encoding:    quoted-printable\n\nFirstname    S=FCrname    is    a    great    guy.')
    self.assertEqual(msg.message().get_payload(1).as_string(), 'Content-Type:    text/html;    charset="iso-8859-1"\nMIME-Version:    1.0\nContent-Transfer-Encoding:    quoted-printable\n\n<p>Firstname    S=FCrname    is    a    <strong>great</strong>    guy.</p>')
