Full Unicode Charmap



To generate datafiles:
#!/usr/bin/env python3

import urllib.request, json

burl = "https://www.unicode.org/Public/UNIDATA/"

blocks = {}
with urllib.request.urlopen(burl+"Blocks.txt") as bf:
    for line in bf:
        line = line.decode()
        if line.startswith("#") or len(line) < 2: continue
        toks = line.strip().split("; ")
        rang = toks[0].split("..")
        blocks[toks[1]] = (int(rang[0], 16), int(rang[1], 16))

with open("uublocks.js", "w") as bf:
    bf.write("var uublocks = ")
    json.dump(blocks, bf)

names = {}
with urllib.request.urlopen(burl+"UnicodeData.txt") as nf:
    for line in nf:
        line = line.decode()
        toks = line.strip().split(";")
        cp = int(toks[0], 16)
        if toks[1]:  names[cp] = toks[1]
        if toks[10]: names[cp] += " / " + toks[10]

with open("uunames.js", "w") as nf: 
    nf.write("var uunames = ")
    json.dump(names, nf)
        








© 07-2020