&#打头的生僻字可以批量替换或者有转Unicode的列表吗?

研究了一下,html entity的编码是utf-16be十进制,先转化成了十六进制,再转化成bytes类型,最后decode就可以了

在python中,把html entity的编码放入string,用下面的函数就可以了。

def convHTML(string):
    hexL = [hex(int(c.strip('&#;'))).replace('0x', '') for c in string.split(';&#')]
    return bytes.fromhex(' '.join(hexL)).decode('utf-16be')