Skip to content

A feature-rich command-line audio/video downloader

Set stdout to binary mode under Windows (fixes issue #218)

Ricardo Garciae08878f498c6
diff --git a/youtube-dl b/youtube-dl
index 094a4164c8..8494be96cb 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -94,6 +94,9 @@ def sanitize_open(filename, open_mode):
"""
try:
if filename == u'-':
+ if sys.platform == 'win32':
+ import msvcrt
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
return (sys.stdout, filename)
stream = open(filename, open_mode)
return (stream, filename)