Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (i - m) iconv_open(3)
NAME
iconv_open - Opens a character code-set converter
LIBRARY
G-series native OSS processes: /G/system/sysnn/zicnvsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zicnvdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yicnvdll |
SYNOPSIS
#include <iconv.h>
iconv_t iconv_open(
const char *tocode,
const char *fromcode);
PARAMETERS
tocode Specifies the destination code set.
fromcode Specifies the originating code set.
DESCRIPTION
The iconv_open( ) function initializes code-set converters. These code set converters are used by
the iconv( ) function to convert characters from one code set to another. The iconv_open( ) func-
tion finds the converter that performs the character code-set conversion specified by the from-
code and tocode parameters, initializes that converter, then returns a conversion descriptor of
type iconv_t that identifies the code-set converter.
The iconv_open( ) function first searches for a code set converter. If it does not find a converter
for the specified code sets, it searches for a conversion table. The converter and conversion table
filenames are formed by concatenating the tocode parameter code-set name onto the fromcode
parameter code-set name, with an underscore between the two, for example:
fromcode tocode Converter or Conversion table file
ct ISO8859-1 ct_ISO8859-1
The iconv_open( ) function searches for the converter in an iconv subdirectory in a directory
specified in the LOCPATH environment variable. If it cannot find a converter, it uses a table-
driven converter and it searches for a conversion table in an iconvTable subdirectory in a direc-
tory specified in the LOCPATH environment variable. If LOCPATH is not defined,
iconv_open( ) uses the default value: /usr/lib/nls/loc.
RETURN VALUES
A conversion descriptor is returned if successful. Otherwise -1 cast to iconv_t is returned, and
errno is set to indicate the error.
ERRORS
If any of the following conditions occur, the iconv_open( ) function sets errno to the correspond-
ing value.
[EMFILE] Specifies that the number of file descriptors specified by the OPEN_MAX
configuration variable is currently open in the calling process.
[ENAMETOOLONG]
A path used to find the code-set converter or the converter table is longer than
PATH_MAX.
527187-017 Hewlett-Packard Company 45