From: Walter Dörwald Date: Thu, 1 Sep 2005 12:03:14 +0000 (+0000) Subject: Backport checkin: X-Git-Tag: v2.4.2c1~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=81e2d6b60a3a767eedb2f7882ffea8bdfb01f73f;p=thirdparty%2FPython%2Fcpython.git Backport checkin: 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 761cc0645166..01adaefd9930 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 b265e33896dd..9a890d526c1f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -141,6 +141,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 -----