(self, codepage, preserve=(), box_protect=None, use_substitutes=False)
Initialise with empty buffer.
Initialise with empty buffer.
Initialise with empty buffer .
def __init__(self, codepage, preserve=(), box_protect=None, use_substitutes=False):
        """Initialise with empty buffer."""
        self._cp = codepage
        # hold one or two bytes
        # lead byte without trail byte, or box-protectable dbcs
        self._buf = b''
        # preserve is a tuple/list of bytes that should keep the same ordinal
        # this is mainly for control characters that have alternate graphical symbols
        self._preserve = set(preserve)
        # may override box protection defaults
        self._box_protect = box_protect or self._cp.box_protect
        self._use_substitutes = use_substitutes
        self._dbcs = self._cp.dbcs
        self._bset = -1
        self._last = b''
def __init__ ( self , codepage , preserve = ( ) , box_protect = None , use_substitutes = False ) : self . _cp = codepage # hold one or two bytes # lead byte without trail byte, or box-protectable dbcs self . _buf = b'' # preserve is a tuple/list of bytes that should keep the same ordinal # this is mainly for control characters that have alternate graphical symbols self . _preserve = set ( preserve ) # may override box protection defaults self . _box_protect = box_protect or self . _cp . box_protect self . _use_substitutes = use_substitutes self . _dbcs = self . _cp . dbcs self . _bset = - 1 self . _last = b''