1.sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8') 不生效
2.re.search("(?<=charset=).*(?=\")", data)抓取网页编码,进行解码不生效
3.
r = requests.get('http://......./')
print(r.encoding) #查看编码,iso8859-1造成乱码
if r.encoding == 'ISO-8859-1':
txt = r.text.encode(r.encoding).decode('gbk')