Commit 1d9de160 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

vbscript/tests: Fix the testChrError() tests in the mixed locale case.

VBscript actually uses the default code page of the user default locale which may not be the same as CP_THREAD_ACP. Also for locales that don't have an ANSI code page, such as Hindi, it falls back to UTF-8. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54003
parent 4e7aa4fb
......@@ -231,6 +231,7 @@ static const char *vt2a(VARIANT *v)
*/
static void detect_locale(void)
{
UINT cp;
CPINFOEXA cpinfo;
HMODULE kernel32 = GetModuleHandleA("kernel32.dll");
LANGID (WINAPI *pGetThreadUILanguage)(void) = (void*)GetProcAddress(kernel32, "GetThreadUILanguage");
......@@ -239,8 +240,17 @@ static void detect_locale(void)
PRIMARYLANGID(GetUserDefaultUILanguage()) == LANG_ENGLISH &&
PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH);
GetCPInfoExA( CP_THREAD_ACP, 0, &cpinfo );
MaxCharSize = cpinfo.MaxCharSize;
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR*)&cp, sizeof(cp));
if (cp)
{
GetCPInfoExA( cp, 0, &cpinfo );
MaxCharSize = cpinfo.MaxCharSize;
}
else
{
/* No ANSI code page for that locale -> the fallback is UTF-8 */
MaxCharSize = 4;
}
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK | LOCALE_RETURN_NUMBER,
(void*)&first_day_of_week, sizeof(first_day_of_week));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment