@@ -178,16 +178,36 @@ The :mod:`email.header` module also provides the following convenient functions.
178178   Decode a message header value without converting the character set. The header
179179   value is in *header *.
180180
181-    This function returns a list of ``(decoded_string, charset) `` pairs containing
182-    each of the decoded parts of the header.  *charset * is ``None `` for non-encoded
183-    parts of the header, otherwise a lower case string containing the name of the
184-    character set specified in the encoded string.
181+    For historical reasons, this function may return either:
185182
186-    Here's an example::
183+    1. A list of pairs containing each of the decoded parts of the header,
184+       ``(decoded_bytes, charset) ``, where *decoded_bytes * is always an instance of
185+       :class: `bytes `, and *charset * is either:
186+ 
187+         - A lower case string containing the name of the character set specified.
188+ 
189+         - ``None `` for non-encoded parts of the header.
190+ 
191+    2. A list of length 1 containing a pair ``(string, None) ``, where
192+       *string * is always an instance of :class: `str `.
193+ 
194+    An :exc: `email.errors.HeaderParseError ` may be raised when certain decoding
195+    errors occur (e.g. a base64 decoding exception).
196+ 
197+    Here are examples:
187198
188199      >>> from  email.header import  decode_header
189200      >>> decode_header(' =?iso-8859-1?q?p=F6stal?='  
190201      [(b'p\xf6stal', 'iso-8859-1')] 
202+       >>> decode_header(' unencoded_string'  
203+       [('unencoded_string', None)] 
204+       >>> decode_header(' bar =?utf-8?B?ZsOzbw==?='  
205+       [(b'bar ', None), (b'f\xc3\xb3o', 'utf-8')] 
206+ 
207+    .. note ::
208+ 
209+        This function exists for for backwards compatibility only. For
210+        new code, we recommend using :class: `email.headerregistry.HeaderRegistry `.
191211
192212
193213.. function :: make_header(decoded_seq, maxlinelen=None, header_name=None, continuation_ws=' ') 
@@ -203,3 +223,7 @@ The :mod:`email.header` module also provides the following convenient functions.
203223   :class: `Header ` instance.  Optional *maxlinelen *, *header_name *, and
204224   *continuation_ws * are as in the :class: `Header ` constructor.
205225
226+    .. note ::
227+ 
228+        This function exists for for backwards compatibility only, and is
229+        not recommended for use in new code.
0 commit comments