diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2016-05-29 19:25:25 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2016-06-02 15:00:49 +0800 |
commit | 9a4aec8b7ea2c0863bc03ba8f3d3e69a61e77c80 (patch) | |
tree | 7de864e262e9d25099f511422afdd8f4ef86dff3 | |
parent | 54fb1996812fa09f0f81ac28f42647e7706212b2 (diff) |
[utils] Use bytes-like objects as header values on Python 2
-rw-r--r-- | youtube_dl/utils.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 6ab1747b3..26f21602c 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -866,6 +866,8 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler): location_escaped = escape_url(location) if location != location_escaped: del resp.headers['Location'] + if sys.version_info < (3, 0): + location_escaped = location_escaped.encode('utf-8') resp.headers['Location'] = location_escaped return resp |