Antoine Pitrou <pit...@free.fr> added the comment:

> I think nttplib's use case can be satisfied via the issue 4661 patch
> coupled with the decode_header bytes-recovery enhancement.

I don't really understand how that could.
nntplib needs to "decode" (in the decode_header sense) headers containing 
unescaped as well as escaped non-ASCII chars. Encoding with "ascii" clearly 
breaks the first use case.

Since the decode_header() API is so silly to begin with, I'd suggest providing 
another higher-level API instead. One which takes an str and returns another 
str (not bytes!) instead of that list of tuples.

If you really want to "fix" the current decode_header(), I'd recommend adding 
an optional "encoding" parameter so that nntplib can give utf-8 instead of 
ascii. nntplib and other consumers will still have to decode back in order to 
get an str, which makes the whole encoding thing a bit useless.

Oh, and instead of None, it would be nicer to give the actual encoding (e.g. 
"ascii"). It's no fun trying to guess.

----------
nosy: +barry

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6302>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to