Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Thread locale is not set correctly under Windows 7

186 views
Skip to first unread message

dbely

unread,
Jun 15, 2010, 8:10:44 AM6/15/10
to
According to http://msdn.microsoft.com/en-us/goglobal/bb964662.aspx
the current thread default locale should be equal to "User locale for
Windows applications and system default locale for console
applications.". This is true for Windows XP, but not for Windows 7
(don't know for Vista). The following program

#include <windows.h>
#include <stdio.h>

void main()
{
CPINFOEX cp;

GetCPInfoEx(CP_ACP, 0, &cp);
printf("CP_ACP: %d\n", cp.CodePage);
GetCPInfoEx(CP_THREAD_ACP, 0, &cp);
printf("CP_THREAD_ACP: %d\n", cp.CodePage);
printf("UserDefaultLangID: %d\n", GetUserDefaultLangID());
printf("SystemDefaultLangID: %d\n", GetSystemDefaultLangID());
}

outputs under XP

CP_ACP: 1251
CP_THREAD_ACP: 1251
UserDefaultLangID: 1049
SystemDefaultLangID: 1049

but under Windows 7

CP_ACP: 1251
CP_THREAD_ACP: 1252
UserDefaultLangID: 1049
SystemDefaultLangID: 1049

Why 1252 code page for CP_THREAD_ACP? Is it a Windows bug or just a
misconfuguration? If the latter how to fix it?

0 new messages