iconv.3c (2010 09)
i
iconv(3C) iconv(3C)
NAME
iconv(), iconv_open(), iconv_close() - codeset conversion routines
SYNOPSIS
#include <iconv.h>
iconv_t iconv_open(const char *
tocode , const char *fromcode
);
size_t iconv(
iconv_t
cd,
const char **inbuf,
size_t *inbytesleft ,
char **outbuf ,
size_t *outbytesleft
);
int iconv_close(iconv_t
cd);
DESCRIPTION
The iconv_open() routine uses the following iconv configuration files in descending order of pre-
cedence:
•
/usr/lib/nls/iconv/system.config.iconv
• /usr/lib/nls/iconv/config.iconv
The system file /usr/lib/nls/iconv/system.config.iconv
is searched first. It cannot be
modified and contains codeset names supported by the operating system. The
/usr/lib/nls/iconv/config.iconv
file, on the other hand, is user-modifiable and can be used by
the system adminstrator or third-party applications to add custom iconv converters.
The configuration files are divided into two sections. The first section is for defining aliases to the canoni-
cal codeset names used in the second section. It is ended by the keyword
end_aliases. The second
section contains the set of conversions (codeset names) that are supported by iconv(). The first two
columns correspond to the fromcode and tocode names. These names may be directly used or their
corresponding aliases may be used as parameters to
iconv_open(). The remaining three columns
corresponds to the name of the translation table, the iconv method, and the corresponding
mblen()
function name and method library (for multi-byte codeset).
The symbol
- is used if the columns are not applicable. The .sl and .so method library suffices in
these configuration files, if present, are now redundant. They are ignored by the iconv_open()
func-
tion, and the right architecture specific method library extension will be appended automatically.
iconv_open() Returns a conversion descriptor that describes a conversion from the codeset
specified by the string pointed to by the fromcode argument to the codeset specified
by the tocode argument.
A conversion descriptor remains valid in a process until that process closes it.
The fromcode and tocode arguments must have a corresponding entry in at least one
of the iconv configuration files.
The iconv_open() function searches the codeset names first in
/usr/lib/nls/iconv/system.config.iconv
and then in
/usr/lib/nls/iconv/config.iconv to check if the requested conversion is
supported. If so,
iconv_open() determines which table and/or method to use for
the conversion.
iconv() Converts a sequence of characters from one codeset that is contained in the array
specified by inbuf , into a sequence of corresponding characters in another codeset,
contained in the array specified by outbuf . The codesets are those specified in the
iconv_open() call that returned the conversion descriptor cd. The inbuf argu-
ment points to a variable that points to the first character in the input buffer, and
inbytesleft indicates the number of remaining bytes in the buffer being converted.
The outbuf argument points to a variable that points to the first available byte in
the output buffer, and outbytesleft indicates the number of the available remaining
bytes in the buffer.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1