SYN-141: Encode query params as UTF-8.

This commit is contained in:
Mark Haines 2014-11-18 19:42:07 +00:00
parent a7f470d1d9
commit 3e54d70ae2
1 changed files with 7 additions and 1 deletions

View File

@ -260,7 +260,13 @@ class MatrixHttpClient(BaseHttpClient):
""" """
logger.debug("get_json args: %s", args) logger.debug("get_json args: %s", args)
query_bytes = urllib.urlencode(args, True) encoded_args = {}
for k, vs in args.items():
if isinstance(vs, basestring):
vs = [vs]
encoded_args[k] = [v.encode("UTF-8") for v in vs]
query_bytes = urllib.urlencode(encoded_args, True)
logger.debug("Query bytes: %s Retry DNS: %s", args, retry_on_dns_fail) logger.debug("Query bytes: %s Retry DNS: %s", args, retry_on_dns_fail)
def body_callback(method, url_bytes, headers_dict): def body_callback(method, url_bytes, headers_dict):