From 3e54d70ae210cc74e62fe5d31308a6d0fb8d31fb Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 18 Nov 2014 19:42:07 +0000 Subject: SYN-141: Encode query params as UTF-8. --- synapse/http/client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'synapse/http') diff --git a/synapse/http/client.py b/synapse/http/client.py index 29e6053bc1..dea61ba1e0 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -260,7 +260,13 @@ class MatrixHttpClient(BaseHttpClient): """ 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) def body_callback(method, url_bytes, headers_dict): -- cgit 1.4.1