]> Devoid-pointer.net GitWeb - libHPCS.git/commitdiff
Fix UTF-8 to wide char file path conversion
authorMichal Maly <madcatxster@devoid-pointer.net>
Tue, 26 Dec 2017 16:38:54 +0000 (17:38 +0100)
committerMichal Maly <madcatxster@devoid-pointer.net>
Tue, 26 Dec 2017 16:38:54 +0000 (17:38 +0100)
src/libHPCS.c

index acbc7c63ff7dc6e3cd2b1b7c29a412dcc831bd2d..17107d6f63450394d16b315261523241a28f48fe 100644 (file)
@@ -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;