[utils] update_url_query: Encode the strings in the query dict
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 4 Mar 2016 21:18:40 +0000 (22:18 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 4 Mar 2016 21:18:40 +0000 (22:18 +0100)
The test case with {'test': '第二行тест'} was failing on python 2 (the non-ascii characters were replaced with '?').

youtube_dl/utils.py

index d431aa6b726c59b40a9c48b3e3144f1d7a2c8db0..22a39a0ab7af191095242e6b2a3f580e59e17c37 100644 (file)
@@ -1743,6 +1743,7 @@ def update_url_query(url, query):
     parsed_url = compat_urlparse.urlparse(url)
     qs = compat_parse_qs(parsed_url.query)
     qs.update(query)
+    qs = encode_dict(qs)
     return compat_urlparse.urlunparse(parsed_url._replace(
         query=compat_urllib_parse.urlencode(qs, True)))