Skip to content

Instantly share code, notes, and snippets.

@bigsnarfdude
Last active October 14, 2021 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigsnarfdude/979319012dc31a70323e5d64ba057e1c to your computer and use it in GitHub Desktop.
Save bigsnarfdude/979319012dc31a70323e5d64ba057e1c to your computer and use it in GitHub Desktop.
clean ascii python
import unicodedata
output = unicodedata.normalize('NFD', my_unicode).encode('ascii', 'ignore')
myfoo = u'àà'
myfoo
u'\xe0\xe0'
unicodedata.normalize('NFD', myfoo).encode('ascii', 'ignore')
'aa'
# https://stackoverflow.com/questions/14118352/how-to-convert-unicode-accented-characters-to-pure-ascii-without-accents
# https://pypi.org/project/Unidecode/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment