[issue1078919] email.Header (via add_header) encodes non-ASCII content incorrectly

Barry A. Warsaw report at bugs.python.org
Mon Oct 4 17:01:20 CEST 2010


Barry A. Warsaw <barry at python.org> added the comment:

RDM, I wonder if it wouldn't be better (in email6) to use an instance to represent the 3-tuple instead?  It might make for clearer client code, and would allow you to default things you might generally not care about.  E.g.

class NonASCIIParameter: # XXX come up with better name
  def __init__(self, text, charset='utf-8', language=''):

It's unfortunate that you have to reorder the arguments from the 3-tuple form of (charset, language, text) but I think you could play games with keyword arguments to make them consistent.

In general the patch looks fine to me, though I suggest splitting test_add_header() into separate tests for each of the three conditions you're testing there.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1078919>
_______________________________________


More information about the Python-bugs-list mailing list