summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/__init__.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2013-05-04 07:09:50 +0200
committerPhilipp Hagemeister <[email protected]>2013-05-04 07:09:50 +0200
commit0d94f2474c9fa280b3ae2d6827bac0adf0d2d597 (patch)
tree997b325187a6ebf119bdb18955b56ba2cf75dd8f /youtube_dl/__init__.py
parent480b6c1e8be96c3769727390f23689857a365135 (diff)
downloadyoutube-dl-0d94f2474c9fa280b3ae2d6827bac0adf0d2d597.tar.gz
youtube-dl-0d94f2474c9fa280b3ae2d6827bac0adf0d2d597.zip
Work around a Python bug on Windows with UTF-8 configuration (#820)
Diffstat (limited to 'youtube_dl/__init__.py')
-rw-r--r--youtube_dl/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index dfcaccafa..b8a82f932 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -30,6 +30,7 @@ __authors__ = (
__license__ = 'Public Domain'
+import codecs
import getpass
import optparse
import os
@@ -335,6 +336,11 @@ def parseOpts(overrideArguments=None):
return parser, opts, args
def _real_main(argv=None):
+ # Compatibility fixes for Windows
+ if sys.platform == 'win32':
+ # https://github.com/rg3/youtube-dl/issues/820
+ codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else None)
+
parser, opts, args = parseOpts(argv)
# Open appropriate CookieJar