Skip to content

Instantly share code, notes, and snippets.

@ddelange
Created March 27, 2020 11:13
Show Gist options
  • Save ddelange/97042a62b705621dc3dc5601f3b8177c to your computer and use it in GitHub Desktop.
Save ddelange/97042a62b705621dc3dc5601f3b8177c to your computer and use it in GitHub Desktop.
Python transliterate / remove accents / normalize accents
import translitcodec
def print_variations(x):
print(x)
print(translitcodec.short_encode(x)[0])
print(translitcodec.long_encode(x)[0])
print_variations("Gesellschaft mit beschränkter Haftung")
print_variations("Société Privée à Responsabilité Limitée")
print_variations("Shoqëri me përgjegjësi të kufizuar")
print_variations("yūgen-kaisha")
print_variations("有限会社")
print_variations("€ ☺")
>>> Gesellschaft mit beschränkter Haftung
>>> Gesellschaft mit beschrankter Haftung
>>> Gesellschaft mit beschraenkter Haftung
>>> Société Privée à Responsabilité Limitée
>>> Societe Privee a Responsabilite Limitee
>>> Societe Privee a Responsabilite Limitee
>>> Shoqëri me përgjegjësi të kufizuar
>>> Shoqeri me pergjegjesi te kufizuar
>>> Shoqeri me pergjegjesi te kufizuar
>>> yūgen-kaisha
>>> yugen-kaisha
>>> yugen-kaisha
>>> 有限会社
>>> 有限会社
>>> 有限会社
>>> € ☺
>>> E :-)
>>> EUR :-)
@ddelange
Copy link
Author

ddelange commented Apr 1, 2023

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