Last active
September 25, 2015 12:40
-
-
Save amake/464930fb36e2909ac7d9 to your computer and use it in GitHub Desktop.
Generate a list of Unicode codepoints that are English words
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
with open('/usr/share/dict/words') as infile: | |
words = infile.read().split() | |
hex_words = [w.upper() for w in words if len(w) == 4 | |
and all(l in 'ABCDEFabcdef' for l in w)] | |
print ('\n'.join([u'U+%s %s' % (w, unichr(int(w, base=16))) | |
for w in sorted(hex_words)]).encode('utf-8')) |
The only hexspeak words I was aware of before making this gist were 0xDEADBEEF
and 0xCAFEBABE
. The gist output does contain DEAD
, BEEF
, and BABE
, but CAFE
is not present because /usr/share/dict/words
doesn't contain "cafe" or "café" for whatever reason.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output:
(Actual
U+Dxxx
removed because surrogates.)