This commit is contained in:
Kovid Goyal 2016-06-16 21:06:03 +05:30
parent 7bf24395a8
commit e9c8ffe5e9

View File

@ -146,6 +146,8 @@ class Detect(object):
while text: while text:
t, text = text[:chunk], text[chunk:] t, text = text[:chunk], text[chunk:]
wt = c_wchar_p(t) wt = c_wchar_p(t)
# Use the fact that len(t) == wcslen(wt) in python 2.7 on
# windows where the python unicode type uses UTF-16
if not self.write_console(self.file_handle, wt, len(t), byref(written), None): if not self.write_console(self.file_handle, wt, len(t), byref(written), None):
# Older versions of windows can fail to write large strings # Older versions of windows can fail to write large strings
# to console with WriteConsoleW (seen it happen on Win XP) # to console with WriteConsoleW (seen it happen on Win XP)