summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-06-18 16:32:27 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-06-18 16:32:27 (GMT)
commit7df08379c65b623df96a534fdacd7302c6a24476 (patch)
treedd936871f360b08e2ff291cb4a72a3d665a29add /Lib/email
parent6a738450827ea77bf8645b14a304a928b7c4ff47 (diff)
parent6bdb1769dcd1a95a7f6fa7d98d05e835be931466 (diff)
downloadcpython-7df08379c65b623df96a534fdacd7302c6a24476.zip
cpython-7df08379c65b623df96a534fdacd7302c6a24476.tar.gz
cpython-7df08379c65b623df96a534fdacd7302c6a24476.tar.bz2
merge #11584: make decode_header handle Header objects correctly
This updates 12e39cd7a0e4 (merge of b21fdfa0019c), which fixed this bug incorrectly.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/header.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/email/header.py b/Lib/email/header.py
index 0a66df5..0670885 100644
--- a/Lib/email/header.py
+++ b/Lib/email/header.py
@@ -73,9 +73,10 @@ def decode_header(header):
An email.errors.HeaderParseError may be raised when certain decoding error
occurs (e.g. a base64 decoding exception).
"""
- # If it is a Header object, we can just return the chunks.
+ # If it is a Header object, we can just return the encoded chunks.
if hasattr(header, '_chunks'):
- return list(header._chunks)
+ return [(_charset._encode(string, str(charset)), str(charset))
+ for string, charset in header._chunks]
# If no encoding, just return the header with no charset.
if not ecre.search(header):
return [(header, None)]