release 2013.02.22
[youtube-dl] / youtube_dl / utils.py
index e6ce028d620e0c68952ffe18813cfb1a885beef7..95bd948438830ca7f98ad82decb722de69319bdf 100644 (file)
@@ -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."""