NNTPlib encoding issue
MRAB
google at mrabarnett.plus.com
Fri Feb 13 07:25:24 EST 2009
mohit_ranka wrote:
> I am getting unknown encoding like, "=?Utf-8?B?QWRyaWFu?=
> <Adrian at discussions.microsoft.com>" (quotes for clarity) for name of
> the author from nntplib module. which seems like an encoding issue
> with NNTPLib module.
>
> What should i do to get author name information in human readable
> format.
>
The original text was encoded in UTF-8 and then into base-64:
=?Utf-8?B?QWRyaWFu?=
^^^^^ UTF-8
=?Utf-8?B?QWRyaWFu?=
^ Base-64
So that's:
>>> "QWRyaWFu".decode("base-64").decode("Utf-8")
u'Adrian'
More information about the Python-list
mailing list