Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -*- coding: utf-8 -*- 

2""" 

3@file 

4@brief Some functions about diacritics 

5""" 

6 

7import unicodedata 

8 

9 

10def remove_diacritics(input_str): 

11 """ 

12 Removes diacritics. 

13 

14 @param input_str string to clean 

15 @return cleaned string 

16 

17 Example:: 

18 

19 enguérand --> enguerand 

20 """ 

21 nkfd_form = unicodedata.normalize('NFKD', input_str) 

22 only_ascii = nkfd_form.encode('ASCII', 'ignore') 

23 return only_ascii.decode("utf8")