vern@2009-12-14:/var% ls tags
python

getPY

RT @https://groups.google.com/group/binsos/browse_thread/thread/1951b77a2cf4bfab

def getPY(s):
    try: chr=s.encode("GB18030")
    except: return s
    if chr<"\xb0\xa1": return s
    if chr>"\xd7\xf9": return u"?"
    if chr<"\xb0\xc5": return u"a"
    if chr<"\xb2\xc1": return u"b"
    if chr<"\xb4\xee": return u"c"
    if chr<"\xb6\xea": return u"d"
    if chr<"\xb7\xa2": return u"e"
    if chr<"\xb8\xc1": return u"f"
    if chr<"\xb9\xfe": return u"g"
    if chr<"\xbb\xf7": return u"h"
    if chr<"\xbf\xa6": return u"j"
    if chr<"\xc0\xac": return u"k"
    if chr<"\xc2\xe8": return u"l"
    if chr<"\xc4\xc3": return u"m"
    if chr<"\xc5\xb6": return u"n"
    if chr<"\xc5\xbe": return u"o"
    if chr<"\xc6\xda": return u"p"
    if chr<"\xc8\xbb": return u"q"
    if chr<"\xc8\xf6": return u"r"
    if chr<"\xcb\xfa": return u"s"
    if chr<"\xcd\xda": return u"t"
    if chr<"\xce\xf4": return u"w"
    if chr<"\xd1\xb9": return u"x"
    if chr<"\xd4\xd1": return u"y"
    if chr<"\xd7\xfa": return u"z"
    return s