It is useful for portable programs which need to process text in other encodings and locales than the currently selected one. Possible uses:
In theory, this would be very simple: POSIX provides the
in such a way that
returns the encoding name. But the
nl_langinfofunction still does not exist on some systems, and on those where it exists it returns unstandardized variations of the encoding names, like (on Solaris) "PCK" for "Shift_JIS".
This library fixes these flaws and provides a function
It determines the current locale's character encoding, and canonicalizes it into one of the canonical names listed in config.charset. The result must not be freed; it is statically allocated. If the canonical name cannot be determined, the result is a non-canonical name.
const char * locale_charset (void);
$ ./configure --prefix=/usr/local $ make $ make install
This library is used in
To integrate this library into your package:
libcharset directory of
Last modified: 18 October 2009.