projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7e34727
)
[utils] Improve encode_dict
author
Sergey M․
<dstftw@gmail.com>
Sat, 21 Nov 2015 14:45:50 +0000
(20:45 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 21 Nov 2015 14:46:33 +0000
(20:46 +0600)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index d00b14b86d8ea8d43aef6bd7cf5a575cda5f94af..bff59eb73320ae611249efce55993873c8d8055a 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-1668,7
+1668,9
@@
def urlencode_postdata(*args, **kargs):
def encode_dict(d, encoding='utf-8'):
- return dict((k.encode(encoding), v.encode(encoding)) for k, v in d.items())
+ def encode(v):
+ return v.encode(encoding) if isinstance(v, compat_basestring) else v
+ return dict((encode(k), encode(v)) for k, v in d.items())
US_RATINGS = {