From 8ee239e9216f12eae38deb079090b677086e9de1 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Thu, 3 Mar 2016 18:47:54 +0800 Subject: [PATCH] [utils] Jython support - handle filenames correctly Now test:youtube downloads --- youtube_dl/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 16b4324a4..fc64a4186 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -467,6 +467,10 @@ def encodeFilename(s, for_subprocess=False): if not for_subprocess and sys.platform == 'win32' and sys.getwindowsversion()[0] >= 5: return s + # Jython assumes filenames are Unicode strings though reported as Python 2.x compatible + if sys.platform.startswith('java'): + return s + return s.encode(get_subprocess_encoding(), 'ignore')