From 1639282434c77f4de005fb0a6b81a49425e64d08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sergey=20M=E2=80=A4?= Date: Sun, 6 Sep 2015 07:22:20 +0600 Subject: [PATCH] [utils] Add encode_dict --- youtube_dl/utils.py | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.39.5