Internationalization and localization tools


Character Conversion Functions

size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);

iconv_t iconv_open(const char *tocode, const char *fromcode);

Internationalization (I18n) Function Overview

The iconv function converts the text in the input buffer inbuf according to the rules associated with the descriptor cd, and stores the result in the output buffer outbuf. If all input from the input buffer is successfully converted and stored in the output buffer, the function returns the number of non-reversible conversions performed. In all other cases the return value is -1 and the global variable errno is set with the error value.

The iconv_open function has to be used before starting a conversion. The two parameters this function takes, fromcode and tocode, determine the source and destination character set for the conversion. A handle is returned if the the conversion can take place. Otherwise, -1 is returned, and the global variable errno is set with the error value.

The iconv and iconv_open functionality is rather involved and beyond the scope of this page. Consult your local documentation that accompanied the iconv package being used. GNU users can reference the GNU iconv documentation here: gnu.org/iconv.

I18n Issues

In an internationalized application, all user text should be in Unicode; encoded as either UTF-8 (multibyte) or UTF-16/32 (wide). These functions can be used to convert text in non-Unicode character sets to Unicode.

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