Internationalization and localization tools


Locale-Sensitive Windows C++ Function

DWORD CharLowerBuff(LPTSTR lpsz, DWORD cchLength);

DWORD CharLowerBuffA(LPSTR lpsz, DWORD cchLength);

DWORD CharLowerBuffW(LPWSTR lpsz, DWORD cchLength);

Internationalization (I18n) Function Overview

The CharLowerBuff function converts up to cchLength TCHAR characters in the buffer pointed to by lpsz to lowercase, based upon the system locale, and returns the number of characters converted.

CharLowerBuffA is the narrow version of the function, passing in a single or multibyte string and the number of bytes to convert, and returning the number of bytes converted.

CharLowerBuffW is the wide version of the function, passing in a wide-character string and the number of wide characters (WCHARs) to convert, and returning the number of wide characters converted.

I18n Issues

Use the appropriate version of the function as required for internationalization support, noting the following:

A Windows MBCS application should not use CharLowerBuff unless the language identifier of the application's locale matches that of the System's default locale, i.e. the LANGID value returned from GetSystemDefaultLangID. This is not an issue for a Windows Unicode application; CharLowerBuff converts the UTF-16 encoded characters correctly.

Ensure that cchLength is correct for the chosen platform; bytes for the narrow version and WCHARs for the wide version. See Locale-Sensitive Length Functions for a discussion on multibyte and wide character sizes.

Recommended Replacements*

When possible, use the Generic version of the function, rather than the narrow or wide versions, and let the Windows #define UNICODE switch determine which version of the function will be called.

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

Locale-Sensitive Windows C++ Functions

 

Lingoport internationalization and localization services and software