def read_codeset(text):
    line_re = re.compile(r"^0x([0-9a-fA-F]{2,6})\s+0x([0-9a-fA-F]{4,6})\s+.*")
    codeset = set()
    for line in text.splitlines():
        m = line_re.match(line)
        if m:
            cp = int(m.group(2), 16)
            codeset.add(cp)
    return codeset