From 0d94f2474c9fa280b3ae2d6827bac0adf0d2d597 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Sat, 4 May 2013 07:09:50 +0200 Subject: [PATCH] Work around a Python bug on Windows with UTF-8 configuration (#820) --- youtube_dl/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.40.0