def encode(value):
"""Encodes bytes to a base65536 string."""
stream = io.StringIO()
length = len(value)
for x in range(0, length, 2):
b1 = indexbytes(value, x)
b2 = indexbytes(value, x + 1) if x + 1 < length else -1
code_point = BLOCK_START[b2] + b1
stream.write(unichr(code_point))
return stream.getvalue()
评论列表
文章目录