Beispiel #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)
Beispiel #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)
Beispiel #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))
def get_list(count):
    return [unicode(i) for i in range(count)]
Beispiel #5
0
def get_list(count):
    return [unicode(i) for i in range(count)]
Beispiel #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))