Created
November 9, 2017 15:45
-
-
Save dvreed77/6d6abc061a53f0127fe4380bd6a26a33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment