Skip to content

Instantly share code, notes, and snippets.

@jone
Created January 7, 2014 10:48
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 jone/8297716 to your computer and use it in GitHub Desktop.
Save jone/8297716 to your computer and use it in GitHub Desktop.
Strip diacricits
import unicodedata
def strip_diacricits(text):
if isinstance(text, str):
text = text.decode('utf-8')
normalized = unicodedata.normalize('NFKD', text)
text = u''.join([c for c in normalized if not unicodedata.combining(c)])
text = text.encode('utf-8')
return text
@jone
Copy link
Author

jone commented Jan 7, 2014

@tschanzt method for removing diacritics

@jone
Copy link
Author

jone commented Jan 7, 2014

@tschanzt method for removing diacritics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment