cr-proxy icon indicating copy to clipboard operation
cr-proxy copied to clipboard

coc/message/reader.py read_string should return as string not bytes

Open akirarat opened this issue 8 years ago • 0 comments

Since reader is just a BufferedReader. self.read() will return a byte array. We should convert this into a UTF-8 string.

def read_string(self):
    length = self.read_int()
    if length == pow(2, 32) - 1:
        return b""
    else:
        try:
            decoded = self.read(length)
        except MemoryError:
            raise IndexError("String out of range.")
        else:
            return decoded

akirarat avatar Oct 17 '16 22:10 akirarat