python+pandas+openpyxl下载xls illegalCharacterError

仅仅是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.

上一篇:Spring Cloud OpenFeign:基于Ribbon和Hystrix的声明式服务调用


下一篇:SpringCloud-OpenFeign