在代码里看到的,感觉没用。删了也能跑,但是不敢删。所以先在这里备份一下。
def b64toUnicode(self, s):
def switch(self, s):
"""
Rewrite the code based on Javascript. May have a shift but no overflow error.
"""
unsignedRshift = lambda val, n: val >> n if val >= 0 else (val + 0x100000000) >> n
L = len(s)
if L == 4:
t = ((7 & ord(s[0])) << 18 | (63 & ord(s[1])) << 12 | (63 & ord(s[2])) << 6 | 63 & ord(s[3])) - 65536
return chr((55296 + unsignedRshift(t, 10)) & 0xffff) + chr((56320 + (1023 & t)) & 0xffff)
elif L == 3:
return chr(((15 & ord(s[0])) << 12 | (63 & ord(s[1])) << 6 | 63 & ord(s[2])) & 0xffff)
else:
return chr(((31 & ord(s[0])) << 6 | 63 & ord(s[1])) & 0xffff)
return re.sub(r'/[À-ß][€-¿]|[à-ï][€-¿]{2}|[ð-÷][€-¿]{3}/g', switch, s)