#11554: reactivate test_email_codecs, and make it pass.

The fix is to charset.py, which was not doing the encoding to the
correct output character set when doing a body_encode for either
the shift-jis or euc-jp charsets.  There's also a fix for handling
a bytes input in encoders.py.

Patch by Michael Henry, comment changes by me.
This commit is contained in:
R David Murray 2011-03-15 12:20:02 -04:00
parent de3909da6b
commit 56a9d7e3da
7 changed files with 54 additions and 22 deletions

View file

@ -3365,9 +3365,9 @@ class TestCharset(unittest.TestCase):
# built-in encodings where the header encoding is QP but the body
# encoding is not.
from email import charset as CharsetModule
CharsetModule.add_charset('fake', CharsetModule.QP, None)
CharsetModule.add_charset('fake', CharsetModule.QP, None, 'utf-8')
c = Charset('fake')
eq('hello w\xf6rld', c.body_encode('hello w\xf6rld'))
eq('hello world', c.body_encode('hello world'))
def test_unicode_charset_name(self):
charset = Charset('us-ascii')