Beispiel #1
0
def decomposition(unichr):
    _validate_unichr(unichr)
    d = Normalizer.decompose(unichr, True)
    decomp_type = None
    if len(d) == 1:
        decomp_type = _get_decomp_type(unichr)
    else:
        for c in d:
            decomp_type = _get_decomp_type(c)
            # print "Got a decomp_type %r %r %r" % (c, d, decomp_type)
            if decomp_type is not None:
                break
    hexed = " ".join(("{0:04X}".format(ord(c)) for c in d))
    if decomp_type:
        return "<{}> {}".format(decomp_type, hexed)
    elif len(d) == 1:
        return ""
    else:
        return hexed