def __init__(self, stream, chunk_size):
self._stream = stream
- self._buffer = ""
+ self._buffer = u""
self._chunk_size = chunk_size
def read_len(self, length):
if len(self._buffer) >= length:
return self._pop(length)
read_len = max(self._chunk_size, length - len(self._buffer))
- self._buffer += self._stream.read(read_len)
+ self._buffer += self._stream.read(read_len).decode("ascii")
def read_line(self, sep='\n'):
start = 0
return self._pop(loc + len(sep))
else:
start = len(self._buffer)
- self._buffer += self._stream.read(self._chunk_size)
+ self._buffer += self._stream.read(self._chunk_size).decode("ascii")
def _pop(self, length):
r = self._buffer[:length]