From 6cf565125d6c202d52b0b7ffdabad77a1f46557b Mon Sep 17 00:00:00 2001 From: Michal Maly Date: Tue, 26 Dec 2017 17:38:54 +0100 Subject: [PATCH] Fix UTF-8 to wide char file path conversion --- src/libHPCS.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libHPCS.c b/src/libHPCS.c index acbc7c6..17107d6 100644 --- a/src/libHPCS.c +++ b/src/libHPCS.c @@ -1251,7 +1251,7 @@ static FILE* __win32_open_data_file(const char* filename) int w_size; /* Get the required size */ - w_size = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, filename, -1, NULL, 0); + w_size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, NULL, 0); if (w_size == 0) { PR_DEBUGF("Count MultiByteToWideChar() error: %x\n", GetLastError()); return NULL; @@ -1260,7 +1260,7 @@ static FILE* __win32_open_data_file(const char* filename) if (w_filename == NULL) return NULL; - if (MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, filename, -1, w_filename, w_size) == 0) { + if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, w_filename, w_size) == 0) { PR_DEBUGF("Convert MultiByteToWideChar() error: %x\n", GetLastError()); free(w_filename); return NULL; -- 2.43.5