标签:sci cte urllib 乱码 python 需要 not pytho 解码
仅仅是urllib2.unquote_plus解码是不够的,需要将特殊字符去掉
ILLEGAL_CHARACTERS_RE = re.compile(r‘[\000-\010]|[\013-\014]|[\016-\037]|\xef|\xbf‘)
value = ILLEGAL_CHARACTERS_RE.sub(‘‘, origin_value)
由于\xef|\xbf的存在,导致字符串乱码,查了一下这是作为utf-8 BOM的存在,需要过滤掉。
BOM: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
ASCII Characters: http://donsnotes.com/tech/charsets/ascii.html
Then, it worked for me.
python+pandas+openpyxl下载xls illegalCharacterError
标签:sci cte urllib 乱码 python 需要 not pytho 解码
原文地址:https://www.cnblogs.com/bierxiaobia/p/9429547.html