无法轻易地做转换
if codeFormat == 'Windows-1254':
# htmlStr = r.text.decode('windows-1254').encode('utf8')
htmlStr = r.text.encode(r.encoding).decode(r.apparent_encoding)
# htmlStr = r.encode('windows-1254').decode('utf8')
#tmpStr = r.text.encode(r.encoding).decode('gbk')
print(htmlStr)
无论是 request 还是 request-html,反正就是怎么转,都提示有些字符无法转...
理论上.encode(r.encoding).decode(r.apparent_encoding)几乎可以万能了吧
python 对编码方面的短板?
Error ''gb2312' codec can't encode character '\ufffd' in position 190: illegal multibyte sequence' happened on line 973