From ef323cf55dae43ce4ca0f50b81c436fb7d1d5b42 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Fri, 25 Nov 2011 21:17:49 +0100 Subject: [PATCH] Win32: sync Unicode console output and file system Use the same Unicode conversion functions for file names and console conversions so that the file system and console output are in sync when checking out legacy encoded repositories (i.e. with invalid UTF-8 file names). Signed-off-by: Karsten Blees --- compat/winansi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compat/winansi.c b/compat/winansi.c index a3e4d88295..9f95954390 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -120,8 +120,7 @@ static void write_console(unsigned char *str, size_t len) static wchar_t wbuf[2 * BUFFER_SIZE + 1]; /* convert utf-8 to utf-16 */ - int wlen = MultiByteToWideChar(CP_UTF8, 0, (char*) str, len, wbuf, - ARRAY_SIZE(wbuf)); + int wlen = xutftowcsn(wbuf, (char*) str, ARRAY_SIZE(wbuf), len); /* write directly to console */ WriteConsoleW(console, wbuf, wlen, NULL, NULL);