diff options
| author | Sergey M․ <dstftw@gmail.com> | 2015-11-21 20:45:50 +0600 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2015-11-21 20:46:33 +0600 | 
| commit | 7e1f5447e76e57af58bf45ce565742c813c80b99 (patch) | |
| tree | 1238f40f3397ab106ce7e82c8acc88cc0f955493 | |
| parent | 7e3472758bfaa75aa413368b29a26c2615e5231b (diff) | |
[utils] Improve encode_dict
| -rw-r--r-- | youtube_dl/utils.py | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index d00b14b86..bff59eb73 100644 --- 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 = { | 
