aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-02-21 17:09:39 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-02-21 17:09:39 +0100
commit8271226a55bd3daa7eddfe2efc243892de02ccf4 (patch)
treec7135d07183cbba75f2f44fb6fb305d4c8223979 /youtube_dl/utils.py
parent1013186a172a05d57e87857604719cae6b8d7049 (diff)
Fix --match-title and --reject-title decoding (Closes #690)
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."""