diff Lib/codecs.py @ 35509:0a28d48636c8 2.4

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.
author Walter Dörwald <walter@livinglogic.de>
date Thu, 01 Sep 2005 12:03:14 +0000
parents 4896f8334bff
children 4806cb009a9c
line wrap: on
line diff
--- a/Lib/codecs.py	Thu Sep 01 06:26:03 2005 +0000
+++ b/Lib/codecs.py	Thu Sep 01 12:03:14 2005 +0000
@@ -556,7 +556,9 @@
     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