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