def __init__(self, bgb=None, encoding=None): self._buf = bgb if bgb is not None else bytegapbuffer() self._encoding = encoding if encoding is not None else 'utf-8' self._index = [] self._length = 0 self._form_initial_index()
def demo_string(): buf = DEMO_BUF return codecs.decode(buf, 'utf-8'), codedstring(bytegapbuffer(buf))
def torture_string(): buf = TORTURE_BUF return ( codecs.decode(buf, 'utf-8', 'replace'), codedstring(bytegapbuffer(buf)) )
def ascii_string(): s = 'hello, world' return s, codedstring(bytegapbuffer(s.encode('utf-8')))