Skip to content

A feature-rich command-line audio/video downloader

Fix UnicodeEncodeError with --write-info-json on Python 2.7 + Windows

Ivan Kozik61ee5aeb7363
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 94b496dd0a..f339fcb313 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -74,7 +74,7 @@ def write_json_file(obj, fn):
""" Encode obj as JSON and write it to fn, atomically """
fn = encodeFilename(fn)
- if sys.version_info < (3, 0):
+ if sys.version_info < (3, 0) and sys.platform != 'win32':
encoding = get_filesystem_encoding()
# os.path.basename returns a bytes object, but NamedTemporaryFile
# will fail if the filename contains non ascii characters unless we