(self, n=-1)
return output
Read n bytes from stream with codepage conversion.
Read n bytes from stream with codepage conversion.
Read n bytes from stream with codepage conversion .
def read(self, n=-1):
        """Read n bytes from stream with codepage conversion."""
        if n > len(self._buffer):
            unistr = self._stream.read(n - len(self._buffer))
        elif n == -1:
            unistr = self._stream.read()
        else:
            unistr = u''
        converted = (self._buffer + self._codepage.unicode_to_bytes(unistr, errors='replace'))
        if n < 0:
            output = converted
        else:
            output, self._buffer = converted[:n], converted[n:]
        return output
def read ( self , n = - 1 ) : if n > len ( self . _buffer ) : unistr = self . _stream . read ( n - len ( self . _buffer ) ) elif n == - 1 : unistr = self . _stream . read ( ) else : unistr = u'' converted = ( self . _buffer + self . _codepage . unicode_to_bytes ( unistr , errors = 'replace' ) ) if n < 0 : output = converted else : output , self . _buffer = converted [ : n ] , converted [ n : ] return output