R. David Murray added the comment:
I agree that this is not the worlds best API. However, it is the API that we
have in 2.7/3.2, and we can't change how Header.__unicode__ behaves without
breaking backward compatibility.
What we could do is add an example of how to use this API to get unicode
strings to the top of the docs:
>>> unicode(make_header(decode_header('=?gb2312?b?1eLKx9bQzsSy4srUo6E=?=')))
u'\u8fd9\u662f\u4e2d\u6587\u6d4b\u8bd5\uff01'
But you already know about that.
In Python 3.3 you get this:
>>> msg = message_from_string("subject:
=?gb2312?b?1eLKx9bQzsSy4srUo6E=?=\n\n", policy=default)
>>> msg['subject']
'这是中文测试!'
So, I'll make this a doc bug.
----------
assignee: -> docs@python
components: +Documentation
nosy: +docs@python
versions: +Python 3.2, Python 3.3, Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17505>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com