From 0c33cc19bbe9fa8d26e83c16b7614561d3bc8c13 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 24 Feb 2014 23:34:17 -0600 Subject: [PATCH] Handle unicode content in the uri module properly Fixes #5869 --- network/uri | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/network/uri b/network/uri index 893a3f408fc..2ede0e0c086 100644 --- a/network/uri +++ b/network/uri @@ -297,7 +297,10 @@ def uri(module, url, dest, user, password, body, method, headers, redirects, soc r['redirected'] = redirected r.update(resp_redir) r.update(resp) - return r, content, dest + try: + return r, unicode(content).encode('utf8'), dest + except: + return r, content, dest except httplib2.RedirectMissingLocation: module.fail_json(msg="A 3xx redirect response code was provided but no Location: header was provided to point to the new location.") except httplib2.RedirectLimit: