New submission from R. David Murray <rdmur...@bitdance.com>:

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.

----------
assignee: r.david.murray
files: header_append.patch
keywords: patch
messages: 124865
nosy: r.david.murray
priority: normal
severity: normal
stage: patch review
status: open
title: Header.append's charset logic is bogus, 'shift_jis' and "euc_jp' don't 
work as charsets
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file20188/header_append.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10790>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to