about summary refs log tree commit diff
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2022-08-21 00:19:19 +0100
committerdirkf <fieldhouse@gmx.net>2022-08-21 00:45:06 +0100
commit556862bc911bb54435b7b0b01451789b884b0390 (patch)
tree7bfd4793a3efe8af04446290f766c10bd9d1ea76
parenta8d5316aaf3dc740aad486b8c394b2f3e70f5a58 (diff)
downloadyoutube-dl-556862bc911bb54435b7b0b01451789b884b0390.tar.gz
youtube-dl-556862bc911bb54435b7b0b01451789b884b0390.tar.xz
youtube-dl-556862bc911bb54435b7b0b01451789b884b0390.zip
[utils] Ensure RFC3986 encoding result is unicode
-rw-r--r--youtube_dl/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index a5f584ec5..fea38ed32 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -3970,7 +3970,8 @@ def escape_rfc3986(s):
     """Escape non-ASCII characters as suggested by RFC 3986"""
     if sys.version_info < (3, 0) and isinstance(s, compat_str):
         s = s.encode('utf-8')
-    return compat_urllib_parse.quote(s, b"%/;:@&=+$,!~*'()?#[]")
+    # ensure unicode: after quoting, it can always be converted
+    return compat_str(compat_urllib_parse.quote(s, b"%/;:@&=+$,!~*'()?#[]"))
 
 
 def escape_url(url):