You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
psrGROUP/env/Lib/site-packages/text_unidecode/__init__.py

22 lines
484 B

# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import pkgutil
_replaces = pkgutil.get_data(__name__, 'data.bin').decode('utf8').split('\x00')
def unidecode(txt):
chars = []
for ch in txt:
codepoint = ord(ch)
if not codepoint:
chars.append('\x00')
continue
try:
chars.append(_replaces[codepoint-1])
except IndexError:
pass
return "".join(chars)