xmlcharrefreplace is only for encoding, not for decoding :-(

This commit is contained in:
Toshio Kuratomi 2015-10-19 10:15:13 -07:00 committed by Matt Clay
parent 721f587e43
commit 931fa9b6b2

View file

@ -472,7 +472,8 @@ def main():
content_type, params = cgi.parse_header(uresp['content_type'])
if 'charset' in params:
content_encoding = params['charset']
u_content = unicode(content, content_encoding, errors='xmlcharrefreplace')
import q ; q.q(content_encoding)
u_content = unicode(content, content_encoding, errors='replace')
if content_type.startswith('application/json') or \
content_type.startswith('text/json'):
try:
@ -481,7 +482,7 @@ def main():
except:
pass
else:
u_content = unicode(content, content_encoding, errors='xmlcharrefreplace')
u_content = unicode(content, content_encoding, errors='replace')
if resp['status'] not in status_code:
module.fail_json(msg="Status code was not " + str(status_code), content=u_content, **uresp)