projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8900ab4
)
[utils] Add encode_compat_str
author
Sergey M․
<dstftw@gmail.com>
Sun, 20 Dec 2015 00:26:26 +0000
(06:26 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Sun, 20 Dec 2015 00:26:26 +0000
(06:26 +0600)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 6d31197606bf67bc2686b24a956a21a2536abd73..9a2dd14390bec0d3f7a694be7d4fcc5f1803bec7 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-1712,6
+1712,10
@@
def encode_dict(d, encoding='utf-8'):
return dict((encode(k), encode(v)) for k, v in d.items())
+def encode_compat_str(string, encoding=preferredencoding(), errors='strict'):
+ return string if isinstance(string, compat_str) else compat_str(string, encoding, errors)
+
+
US_RATINGS = {
'G': 0,
'PG': 10,