The newlib iconv library also has some interface functions (besides the
iconv, iconv_open and iconv_close interfaces) which
are intended for the Locale subsystem. All the locale-related code is
placed in the lib/iconvnls.c file.
The following is the description of the locale-related interfaces:
_iconv_nls_open - opens two iconv descriptors for "CCS ->
wchar_t" and "wchar_t -> CCS" conversions. The normalized CCS name is
passed in the function parameters. The wchar_t characters encoding is
either ucs_2_internal or ucs_4_internal depending on size of
wchar_t.
_iconv_nls_conv - the function is similar to the iconv
functions, but if there is no character in the output encoding which
corresponds to the character in the input encoding, the default
conversion isn’t performed (the iconv function sets such output
characters to the ? symbol and this is the behavior, which is
specified in SUSv3).
_iconv_nls_get_state - returns the current encoding’s shift state
(the mbstate_t object).
_iconv_nls_set_state sets the current encoding’s shift state (the
mbstate_t object).
_iconv_nls_is_stateful - checks whether the encoding is stateful
or stateless.
_iconv_nls_get_mb_cur_max - returns the maximum length (the
maximum bytes number) of the encoding’s characters.