From 931fa9b6b246ff7661d2d908756473fef1515809 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 19 Oct 2015 10:15:13 -0700 Subject: [PATCH] xmlcharrefreplace is only for encoding, not for decoding :-( --- lib/ansible/modules/network/basics/uri.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/basics/uri.py b/lib/ansible/modules/network/basics/uri.py index 7e655180230..7bdf1f021c9 100644 --- a/lib/ansible/modules/network/basics/uri.py +++ b/lib/ansible/modules/network/basics/uri.py @@ -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)