dvreed77
11/9/2017 - 3:45 PM

Decode Unicode

a = 'CURAÌàAO'
def normalize_str(x):
    if type(x) != unicode:
        encoding = "utf-8" # or iso-8859-15, or cp1252, or whatever encoding you use
        byte_string = bytes(x)  # or simply "café" before python 3.
        unicode_string = byte_string.decode(encoding)
    else:
        unicode_string = x
    return unicodedata.normalize('NFD', unicode_string).encode('ascii','ignore')