Coverage for pyquickhelper/texthelper/diacritic_helper.py: 100%
6 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
1# -*- coding: utf-8 -*-
2"""
3@file
4@brief Some functions about diacritics
5"""
7import unicodedata
10def remove_diacritics(input_str):
11 """
12 Removes diacritics.
14 @param input_str string to clean
15 @return cleaned string
17 Example::
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")