iconv_open(3)iconv_open(3)NAMEiconv_open - Open a character codeset converter
const char *tocode,
const char *fromcode );
The iconv library (libiconv)
Interfaces documented on this reference page conform to industry stan‐
dards as follows:
Refer to the standards(5) reference page for more information about
industry standards and associated tags.
Specifies the destination codeset. Specifies the originating codeset.
The iconv_open() function initializes a codeset converter. This con‐
verter is used by the iconv function to convert characters from one
codeset to another. The iconv_open() function finds the converter that
performs the character conversion specified by the fromcode and tocode
parameters, initializes that converter, then returns a conversion
descriptor of type iconv_t that identifies the converter.
The conversion descriptor returned by this function remains valid until
the descriptor is closed for the process in which the application is
run. The descriptor can be closed by an iconv_close() call in which
the descriptor is an argument or by a call to one of the exec() func‐
Note that standards do not define where codeset converters reside or
how vendors implement them.
[Tru64 UNIX] The iconv_open() codesets, the function then searches for
a table converter. The algorithmic and table converter file names are
formed by concatenating the tocode parameter codeset name onto the
fromcode parameter codeset name, with an underscore between the two,
fromcode=ct tocode=ISO8859-1 Converter name=ct_ISO8859-1
[Tru64 UNIX] The iconv_open() function searches for an algorithmic
converter in an iconv subdirectory of the directory specified in the
LOCPATH environment variable. The function searches for a table con‐
verter in an iconvTable subdirectory of the directory specified in the
LOCPATH environment variable. If LOCPATH is not defined, iconv_open()
uses the default value: /usr/lib/nls/loc.
[Tru64 UNIX] The LOCPATH variable also overrides the default search
path (/usr/lib/nls/loc) that is used to find locales. If this variable
is defined, it must therefore specify a search path that application
and system software can use to find both locales and converters. The
LOCPATH variable is not defined by any standard, so use of the variable
should be limited to testing locales or converters under development.
On successful completion, the iconv_open() function returns a conver‐
sion descriptor. Otherwise, the function returns -1 cast to iconv_t and
sets errno to indicate the error.
If any of the following conditions occur, the iconv_open() function
sets errno to the corresponding value: The number of file descriptors
specified by the OPEN_MAX configuration variable is currently open in
the calling process.
[Tru64 UNIX] Either the OPEN_MAX value or the per-process soft
descriptor limit is checked. [Tru64 UNIX] The path used to
find the codeset converter is longer than PATH_MAX. Too many
files are currently open in the system. Insufficient virtual
memory is available. The conversion specified by the fromcode
and tocode parameters is not supported.
[Tru64 UNIX] This condition may also indicate an incorrect LOC‐
PATH setting because support for the specified conversion is
determined by finding a converter whose name also specifies that
Commands: genxlt(1), iconv(1)
Functions: iconv(3), iconv_close(3)
Others: iconv_intro(5), standards(5)iconv_open(3)