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