Internationalization and localization tools


Windows C++ Locale Function

BOOL GetCPInfo(UINT CodePage, LPCPINFO lpCPInfo);

BOOL GetCPInfoEx(UINT CodePage, DWORD dwFlags, LPCPINFOEX lpCPInfoEx);

BOOL GetCPInfoExA(UINT CodePage, DWORD dwFlags, LPCPINFOEXA lpCPInfoEx);

BOOL GetCPInfoExW(UINT CodePage, DWORD dwFlags, LPCPINFOEXW lpCPInfoEx);

Internationalization (I18n) Function Overview

The GetCPInfo function retrieves information about any valid installed or available code page specified by CodePage and stores the information in the structure pointed to by lpCPInfo. The return value is 1 if successful; else 0 is returned and extended error information can be obtained by calling GetLastError.

To obtain additional information about valid installed or available code pages, use GetCPInfoEx, which stores the information in a more detailed structure pointed to by lpCPInfoEx. GetCPInfoExA and GetCPInfoExW are the narrow and wide versions of GetCPInfoEx; GetCPInfoExA stores the code page name in the lpCPInfoEx structure as a single or multibyte string, whereas GetCPInfoExW writes a wide-character string to the structure.

Click here and here for additional information from the MSDN Library.

I18n Issues

Formulate the correct code page to pass into GetCPInfo or GetCPInfoEx. Although there are two predefined code page constants that may be used: CP_ACP (the system's default ANSI code page returned by GetACP) and CP_OEMCP (the system's default OEM code page returned by GetOEMCP), neither of these will work in an internationalized application where the language is independent of the user's system settings. On Windows 2K/XP, CP_THREAD_ACP can be used, which will access the current thread's ANSI code page and which the application can set by calling SetThreadLocale.

Recommended Replacements*

There are no variations of the function call.

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

Windows C++ Locale Functions

 

Lingoport internationalization and localization services and software