Skip to content

Instantly share code, notes, and snippets.

@zarzen
Last active August 13, 2018 20:24
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 zarzen/3aa52ab117769e91bf912d7f31570c32 to your computer and use it in GitHub Desktop.
Save zarzen/3aa52ab117769e91bf912d7f31570c32 to your computer and use it in GitHub Desktop.
turn unicode string to plain ascii
# Turn a Unicode string to plain ASCII, thanks to
# http://stackoverflow.com/a/518232/2809427
def unicodeToAscii(s):
return ''.join(
c for c in unicodedata.normalize('NFD', s)
if unicodedata.category(c) != 'Mn'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment