From: Jaime Marquínez Ferrándiz Date: Fri, 4 Mar 2016 21:18:40 +0000 (+0100) Subject: [utils] update_url_query: Encode the strings in the query dict X-Git-Tag: 2021.01.07~6242 X-Git-Url: https://jfr.im/git/yt-dlp.git/commitdiff_plain/3233a68fbb1cb608534db43f358f7203e59cd2de [utils] update_url_query: Encode the strings in the query dict The test case with {'test': '第二行тест'} was failing on python 2 (the non-ascii characters were replaced with '?'). --- diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index d431aa6b7..22a39a0ab 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -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)))