Simplfy the default CODEC_MAP in Charset.py to not include the Japanese and
Korean codecs. The names of the codecs are different depending on whether
you're using Python 2.4 and 2.5, which include the codecs by default, or
earlier Python's which provide the codecs under different names as a third
party library. Now, we attempt to discover which (if either) is available and
populate the CODEC_MAP as appropriate.
Message.set_charset(): When the message does not already have a
Content-Transfer-Encoding header, instead of just adding the header, we also
encode the body as defined by the assigned Charset. As before, if the
body_encoding is callable, we just call that. If not, then we add a call to
body_encode() before setting the header. This way, we guarantee that a
message's text payload is always encoded properly.
Remove the payload encoding code from Generator._handle_text(). With the
above patch, this would cause the body to be doubly encoded. Doing this in
the Message class is better than only doing it in the Generator.
Added some new tests to ensure everything works correctly. Also changed the
way the test_email_codecs.py tests get added (using the same lookup code that
the CODEC_MAP adjustments use).
This resolves both issues for email 2.5/Python 2.3. I will patch forward to
email 3.0 for both Python 2.4 and 2.5.