diff --git a/Lib/email/header.py b/Lib/email/header.py --- a/Lib/email/header.py +++ b/Lib/email/header.py @@ -70,7 +70,7 @@ occurs (e.g. a base64 decoding exception). """ # If no encoding, just return the header with no charset. - if not ecre.search(header): + if not ecre.search(str(header)): return [(header, None)] # First step is to parse all the encoded parts into triplets of the form # (encoded_string, encoding, charset). For unencoded strings, the last @@ -265,6 +265,9 @@ charset = self._charset elif not isinstance(charset, Charset): charset = Charset(charset) + # Steffen is out now + if isinstance(s, email.header.Header): + s = str(s) if not isinstance(s, str): input_charset = charset.input_codec or 'us-ascii' s = s.decode(input_charset, errors)