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

View File

@ -141,10 +141,10 @@ class Detect(object):
if self.is_console:
from ctypes import wintypes, byref, c_wchar_p
written = wintypes.DWORD(0)
text = text.replace('\0', '')
chunk = len(text)
while text:
t, text = text[:chunk], text[chunk:]
t = t.partition('\0')[0]
wt = c_wchar_p(t)
if not self.write_console(self.file_handle, wt, len(t), byref(written), None):
# Older versions of windows can fail to write large strings