classification
Title: email.header.decode_header data types are inconsistent and incorrectly documented
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.2, Python 3.1
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: r.david.murray (1)
Priority: normal Keywords

Created on 2009-06-18 01:36 by r.david.murray, last changed 2009-06-18 01:36 by r.david.murray.

Messages (1)
msg89488 - (view) Author: R. David Murray (r.david.murray) Date: 2009-06-18 01:36
decode_header only accepts str as input.  If the input contains no
encoded words, the output is str (ie: the input string) and None.  If it
does contain encoded words, the output is pairs of bytes plus str
charset identifiers (or None).  This makes it difficult to use this
function to decode headers, since one has to test for the special case
of str output when there are no encoded words.

I think decode_header should take bytes as input, and output (bytes.
str) pairs consistently.

In any case, the documentation is wrong since it says it returns
strings.  The example is also wrong, since the actual output is:

[(b'p\xf6stal', 'iso-8859-1')]
History
Date User Action Args
2009-06-18 01:37:46r.david.murraylinkissue1685453 dependencies
2009-06-18 01:36:14r.david.murraycreate