Force string in Python3 to ascii convertion

This commit is contained in:
nicolargo 2017-12-16 16:16:54 +01:00
parent 54b61fd5a0
commit 205bed0277

View File

@ -65,8 +65,8 @@ if PY3:
"""Convert the bytes string to a ASCII string
Usefull to remove accent (diacritics)"""
if isinstance(s, binary_type):
return s
return s.encode('ascii', 'ignore')
return s.decode()
return s.encode('ascii', 'ignore').decode()
def listitems(d):
return list(d.items())