Internationalization and localization tools


Locale-Sensitive Windows C++ Function

LPTSTR CharNext(LPCTSTR lpsz);

LPSTR CharNextA(LPCSTR lpsz);

LPWSTR CharNextW(LPCWSTR lpsz);

Internationalization (I18n) Function Overview

The CharNext function returns a pointer to the next character in the null-terminated string pointed to by lpsz. If lpsz is pointing at the NULL character, then CharNext returns lpsz.

The narrow version of the function, CharNextA, handles single-byte or multibyte character strings, using the system default code page to determine the number of bytes that make up the character.

CharNextW operates on a wide-character string.

I18n Issues

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

A Windows MBCS application should not use CharNext 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 Otherwise, the multibyte code page will not match the application's language and CharNext will not correctly traverse the multibyte-character string. Consider using CharNextExA, which allows the multibyte code page to be specified as an argument.

A Windows Unicode application can safely call CharNext; it will traverse the wide-character string correctly.

Recommended Replacements*

Note that in an MBCS application, CharNextExA will need to be called explicitly, rather than calling the Generic version CharNext, since the narrow version of CharNext is CharNextA.

*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