All pastes #131399 Raw Edit

FlyingPenguin

public python v1 · immutable
#131399 ·published 2006-08-14 13:59 UTC
rendered paste body
def any2ascii(string):    from unicodedata import normalize    string = str(string)    for char in ("utf-8","ascii","latin-1"):        try:            uni=unicode(string, char)        except UnicodeDecodeError: continue        else:            return normalize('NFKD', uni).encode('ascii','ignore')