Skip to content

Instantly share code, notes, and snippets.

@vitalizzare
Created August 17, 2021 20:39
Show Gist options
  • Save vitalizzare/0ea5df86e716ac4bf8ebbb4bd2f650b7 to your computer and use it in GitHub Desktop.
Save vitalizzare/0ea5df86e716ac4bf8ebbb4bd2f650b7 to your computer and use it in GitHub Desktop.
#!/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