Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)

User Commands (g - j) iconv(1)
NAME
iconv - Converts encoded characters to another code set
SYNOPSIS
iconv
-f from_code
-t to_code
[file ...]
FLAGS
-f from_code
Specifies the input code set
-t to_code
Specifies the output code set
Operands
file specifies the file to be converted
DESCRIPTION
The iconv command converts the encoding of characters in file from one coded character set to
another and writes the results to the standard output file.
The input and output coded character sets are identified by the arguments from_code and
to_code. If the file operand is not specified on the the command line, the iconv command reads
the standard input file.
If you specify invalid characters in the input stream, iconv returns an error message, writes the
already converted data to standard output, and exits with a status greater than 0 (zero.)
If you specify characters in the input stream that are valid members of the input code set but are
invalid members of the output code set, the input value is translated into a substitute character.
Such conversions are called non-identical conversions. The value of the substitute character
depends on the output code set specified.
The default value is 0x1A (the ASCII character SUB); the default value is 0xFFFD (the UCS-2
REPLACEMENT CHARACTER) for conversions to the UCS-2 code set. If the conversion is
done by using a table, the substitute character may be specified by a target_sub directive in the
source translation table. The default is 0x1A if there is no target_sub directive.
If a non-identical conversion occurred while converting an input file, the iconv utility will
attempt to print a warning message to the standard error file, once per file. If an input file is large
it is possible that the non-identical conversion warning will not be printed, even if such conver-
sions occurred. The exit status is not affected by a non-identical conversion.
If the LOCPATH environment variable is not defined or is set to the empty string (""), iconv
looks for converters and conversion tables in the default path: /usr/lib/nls/loc:/etc/nls/loc.
Otherwise, iconv looks in the directories specified by LOCPATH. If no valid converters or
conversion tables are found in the directories specified by LOCPATH, the default path is
searched too. If the superuser is using iconv, LOCPATH is ignored. $LOCPATH is an environ-
ment variable which, if set, specifies directories containing the iconv and iconvTable subdirec-
tories to be used instead of the default directories. The value of $LOCPATH must be a colon-
separated list of directories in which iconv can find the subdirectories containing converters and
conversion tables. Specified directories must have the same organization as the /usr/lib/nls/loc
directory.
527188-021 Hewlett-Packard Company 451