[issue10284] Exception raised when decoding NNTP newsgroup descriptions

Antoine Pitrou report at bugs.python.org
Tue Nov 2 23:48:21 CET 2010

Antoine Pitrou <pitrou at free.fr> added the comment:

> Antoine, a news client could guess it because of the Content-Type:
> header field (in this example, it mentions charset="gb2312").
> Yet, articles without a Content-Type: header field exist in the
> wild...

Unless I'm mistaken, Content-Type should only apply to the body, not the
headers. Either the headers use UTF-8 (RFC 3977), or they should be
MIME-encoded. Everything else is undecodable.

> There is no way to always make the right guess, unfortunately.
> News clients try to do their best :-)

Well, a news client built on nntplib could also try to do its best :)

> Yes, I mean b"\xC9ric".  4 bytes.

Ok, perhaps we should allow bytes username and password.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list