diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-09-06 07:22:20 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-09-06 07:22:20 +0600 |
commit | 1639282434c77f4de005fb0a6b81a49425e64d08 (patch) | |
tree | f782f95b040dff305a62c6e2b27e5c8818e29fd4 | |
parent | be0e5dbd8356e92f8032d4cf8be2e668f1b30539 (diff) |
[utils] Add encode_dict
-rw-r--r-- | youtube_dl/utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 7cf91ac19..5529d5291 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1638,6 +1638,10 @@ def urlencode_postdata(*args, **kargs): return compat_urllib_parse.urlencode(*args, **kargs).encode('ascii') +def encode_dict(d, encoding='utf-8'): + return dict((k.encode(encoding), v.encode(encoding)) for k, v in d.items()) + + try: etree_iter = xml.etree.ElementTree.Element.iter except AttributeError: # Python <=2.6 |