Ejemplo n.º 1
0
def smart_decode(s):
    if isinstance(s, unicode):
        return s
    elif isinstance(s, bytestr):
        # Should never reach this case in Python 3
        return unicode(s, 'utf-8')
    else:
        return unicode(s)
Ejemplo n.º 2
0
def smart_decode(s):
    if isinstance(s, unicode):
        return s
    elif isinstance(s, bytestr):
        # Should never reach this case in Python 3
        return unicode(s, "utf-8")
    else:
        return unicode(s)
Ejemplo n.º 3
0
def encode_bytearray(barray):
    if isbytestr(barray):
        return unicode().join((unichr(ord(by) << 8) for by in barray))
    else:
        return unicode().join((unichr(by << 8) for by in barray))
Ejemplo n.º 4
0
def get_list(count):
    return [unicode(i) for i in range(count)]
Ejemplo n.º 5
0
def get_list(count):
    return [unicode(i) for i in range(count)]
Ejemplo n.º 6
0
def encode_bytearray(barray):
    if isbytestr(barray):
        return unicode().join((unichr(ord(by) << 8) for by in barray))
    else:
        return unicode().join((unichr(by << 8) for by in barray))