[issue21492] email.header.decode_header sometimes returns bytes, sometimes str

Berker Peksag report at bugs.python.org
Tue May 13 13:44:48 CEST 2014


Berker Peksag added the comment:

> >>> email.header.decode_header("foo")
> [('foo', None)]

email.header.decode_header() implements rfc-2047 and the "foo" header doesn't match the syntax described in rfc-2047 (see "2. Syntax of encoded-words").

See the code for more information:

* http://hg.python.org/cpython/file/default/Lib/email/header.py#l34
* http://hg.python.org/cpython/file/default/Lib/email/header.py#l81

See the "6.1. Recognition of 'encoded-word's in message headers" section at http://www.rfc-base.org/txt/rfc-2047.txt

----------
components: +email
nosy: +barry, berker.peksag, r.david.murray

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


More information about the Python-bugs-list mailing list