aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index e6ce028d6..95bd94843 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -420,6 +420,14 @@ def encodeFilename(s):
encoding = 'utf-8'
return s.encode(encoding, 'ignore')
+def decodeOption(optval):
+ if optval is None:
+ return optval
+ if isinstance(optval, bytes):
+ optval = optval.decode(preferredencoding())
+
+ assert isinstance(optval, compat_str)
+ return optval
class ExtractorError(Exception):
"""Error during info extraction."""