Internationalization and localization tools


Multibyte and Wide Character Conversion Function

size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);

Internationalization (I18n) Function Overview

The mbrtowc function converts the multibyte character pointed to by s to a wide character and stores the result in pwc, if pwc is not NULL. It uses the mbstate_t ps to track the state of the conversion and returns the number of bytes successfully converted, not including the terminating null byte; or (size_t)-2 if, after converting all n characters, the resulting conversion state indicates an incomplete multibyte character; or 0, if the next completed character is a null character, in which case the resulting conversion state is the initial conversion state; or (size_t)-1 in the event of an error.

If s is a null pointer, mbrtowc uses an internal state object to track the conversion.

I18n Issues

Prior to calling mbrtowc, ensure that the current locale is set correctly.

Recommended Replacements*

There are no variations of this conversion function.

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

Multibyte and Wide Character Conversion Functions

 

Lingoport internationalization and localization services and software