Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 32a13e5

Browse files
kbleeskasal
authored andcommitted
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 <[email protected]>
1 parent 9e3b36e commit 32a13e5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compat/winansi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ static void write_console(unsigned char *str, size_t len)
120120
static wchar_t wbuf[2 * BUFFER_SIZE + 1];
121121

122122
/* convert utf-8 to utf-16 */
123-
int wlen = MultiByteToWideChar(CP_UTF8, 0, (char*) str, len, wbuf,
124-
ARRAY_SIZE(wbuf));
123+
int wlen = xutftowcsn(wbuf, (char*) str, ARRAY_SIZE(wbuf), len);
125124

126125
/* write directly to console */
127126
WriteConsoleW(console, wbuf, wlen, NULL, NULL);

0 commit comments

Comments
 (0)