Created
August 17, 2021 20:39
-
-
Save vitalizzare/0ea5df86e716ac4bf8ebbb4bd2f650b7 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# Check whether we can obtain names for the control characters | |
# with the unicodedata.name method in python | |
curl --silent 'https://www.unicode.org/Public/13.0.0/ucd/NameAliases.txt' |\ | |
sed '/^\ *$/d; /^#.*/d' |\ | |
python -c ' | |
import unicodedata | |
from collections import Counter | |
passed = Counter() | |
failed = Counter() | |
while True: | |
try: | |
code, name, category = input().split(";") | |
try: | |
unicodedata.name(chr(int(code, 16))) | |
#unicodedata.lookup(name) | |
except ValueError: | |
failed[category] += 1 | |
else: | |
passed[category] += 1 | |
except EOFError: | |
break | |
print(f"{failed=}") | |
print(f"{passed=}") | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment