Created
December 5, 2015 02:45
-
-
Save jtauber/ce4bb07f539461de84a1 to your computer and use it in GitHub Desktop.
NFKC normalisation in python 2 and 3
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
import unicodedata | |
with open(sys.argv[1]) as f: | |
for line in f: | |
sys.stdout.write(unicodedata.normalize("NFKC", line.decode("utf-8")).encode("utf-8")) |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import sys | |
import unicodedata | |
with open(sys.argv[1]) as f: | |
for line in f: | |
sys.stdout.write(unicodedata.normalize("NFKC", line)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment