This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients r.david.murray
Date 2010-12-29.18:38:17
SpamBayes Score 4.0721218e-09
Marked as misclassified No
Message-id <1293647903.09.0.559364426725.issue10790@psf.upfronthosting.co.za>
In-reply-to
Content
Working on issue 10686, I've discovered that the logic for charset conversion in email.header.Header.append is bogus.  It happens to work for most charsets because for most charsets the input codec and the output codec are the same.  For shift_jis and euc_jp, however, this is not the case.

The attached patch fixes the logic and provides a test.

The logic is still not quite correct, since the 'errors' parameter should not be passed to the 'encode' test call, because the errors parameter is not passed to the encode call when the actual encoding is done in the Header.encode method.  If that call were fixed in this patch, one of the email tests would fail that currently passes.  However, if a 'Header.encode' call were made in that test, the encode call would fail.  Fixing that will require resolving issue 10686.
History
Date User Action Args
2010-12-29 18:38:23r.david.murraysetrecipients: + r.david.murray
2010-12-29 18:38:23r.david.murraysetmessageid: <1293647903.09.0.559364426725.issue10790@psf.upfronthosting.co.za>
2010-12-29 18:38:17r.david.murraylinkissue10790 messages
2010-12-29 18:38:17r.david.murraycreate