Created
March 27, 2020 11:13
-
-
Save ddelange/97042a62b705621dc3dc5601f3b8177c to your computer and use it in GitHub Desktop.
Python transliterate / remove accents / normalize accents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comparing unicode strings: