diff options
-rw-r--r-- | youtube_dl/utils.py | 7 | ||||
-rw-r--r-- | youtube_dl/version.py | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index b57fd7a33..9c9320934 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -923,6 +923,9 @@ def _windows_write_string(s, out): 2: -12, } + def ucs2_len(s): + return sum((2 if ord(c) > 0xffff else 1) for c in s) + fileno = out.fileno() if fileno not in WIN_OUTPUT_IDS: return False @@ -956,10 +959,10 @@ def _windows_write_string(s, out): if not_a_console(h): return False - remaining = len(s) + remaining = ucs2_len(s) while remaining > 0: ret = WriteConsoleW( - h, s, min(len(s), 1024), ctypes.byref(written), None) + h, s, min(remaining, 1024), ctypes.byref(written), None) if ret == 0: raise OSError('Failed to write string') remaining -= written.value diff --git a/youtube_dl/version.py b/youtube_dl/version.py index f8c3d235f..0d18e5405 100644 --- a/youtube_dl/version.py +++ b/youtube_dl/version.py @@ -1,2 +1,2 @@ -__version__ = '2014.04.07.3' +__version__ = '2014.04.07.4' |