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 <blees@dcon.de>
This commit is contained in:
Karsten Blees
2011-11-25 21:17:49 +01:00
committed by Johannes Schindelin
parent dd490e32cf
commit 765fd87c5f

View File

@@ -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);