This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients barry, docs@python, hniksic, r.david.murray
Date 2013-03-21.18:41:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1363891306.58.0.54271627326.issue17505@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-03-21 18:41:46r.david.murraysetrecipients: + r.david.murray, barry, hniksic, docs@python
2013-03-21 18:41:46r.david.murraysetmessageid: <1363891306.58.0.54271627326.issue17505@psf.upfronthosting.co.za>
2013-03-21 18:41:46r.david.murraylinkissue17505 messages
2013-03-21 18:41:46r.david.murraycreate