Browse Source

fix crashing in DOS version when language file specified (#32)

fix crashing in DOS version when language file specified with method from louyihua
Pal Lockheart 7 years ago
parent
commit
f2734d2e3c
1 changed files with 3 additions and 2 deletions
  1. 3 2
      font.c

+ 3 - 2
font.c

@@ -85,14 +85,15 @@ static void PAL_LoadEmbeddedFont(void)
 
 	//
 	// Convert characters into unicode
+	// Explictly specify BIG5 here for compatibility with codepage auto-detection
 	//
-	nChars = PAL_MultiByteToWideChar(char_buf, nBytes, NULL, 0);
+	nChars = PAL_MultiByteToWideCharCP(CP_BIG5, char_buf, nBytes, NULL, 0);
 	if (NULL == (wchar_buf = (wchar_t *)malloc(nChars * sizeof(wchar_t))))
 	{
 		free(char_buf);
 		return;
 	}
-	PAL_MultiByteToWideChar(char_buf, nBytes, wchar_buf, nChars);
+	PAL_MultiByteToWideCharCP(CP_BIG5, char_buf, nBytes, wchar_buf, nChars);
 	free(char_buf);
 
 	//