From: Walter Dörwald Date: Thu, 1 Sep 2005 11:56:53 +0000 (+0000) Subject: SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it reads X-Git-Tag: v2.5a0~1410 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c5238b82887c9f0507632aec206739c3bb7a1caf;p=thirdparty%2FPython%2Fcpython.git SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it reads from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string. --- diff --git a/Lib/codecs.py b/Lib/codecs.py index a964f9918860..d972a5191fd7 100644 --- a/Lib/codecs.py +++ b/Lib/codecs.py @@ -556,7 +556,9 @@ class StreamRecoder: def next(self): """ Return the next decoded line from the input stream.""" - return self.reader.next() + data = self.reader.next() + data, bytesencoded = self.encode(data, self.errors) + return data def __iter__(self): return self diff --git a/Misc/NEWS b/Misc/NEWS index 307b359a5109..3ac8db452c55 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -439,6 +439,9 @@ Library about illegal code points. The codec now supports PEP 293 style error handlers. +- Bug #1235646: ^^codecs.StreamRecoder.next()^^ now reencodes the data it reads + from the input stream, so that the output is a byte string in the correct + encoding instead of a unicode string. Build -----