projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
be0e5db
)
[utils] Add encode_dict
author
Sergey M․
<dstftw@gmail.com>
Sun, 6 Sep 2015 01:22:20 +0000
(07:22 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Sun, 6 Sep 2015 01:22:20 +0000
(07:22 +0600)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 7cf91ac192f89cf75e6d75869b3ee12976e2ada3..5529d5291cda4df65279525eb581b475cb19dca9 100644
(file)
--- 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