iconv

convert characters from one code set to another

Command


SYNOPSIS

iconv [-sc] -f oldset -t newset [file ...]

iconv -l [-v]


DESCRIPTION

The iconv command converts characters in file (or from standard input if no file is specified) from one code set to another. The converted text is written to standard output. iconv uses both code sets stored in internal tables and code sets in stored as external files. When a code set is specified, iconv first searches its internal table. If the code set is not in the internal table and the code set name is an absolute path name, iconv looks for that file. If the code set is not in the internal table and the file looks like a relative path name, iconv treats it as a file name in the directory library/iconv, where library is the library directory.

If the input contains a character which is invalid in the source code set, iconv replaces it with the byte 0xff and continues, unless the -c option is specified. If the input contains a character which is invalid in the destination code set, iconv replaces it with the underscore character (_) in the destination code set, and continues.

Options

-c

cleans away characters which had conversion errors; these characters are not written to the output. By default, characters not in the source character set are converted to the value 0xff and written to the output.

-f oldset

specifies the current code set of the input. oldset can be either the code set name or a path name to a file containing an external code set.

-l

lists code sets in the internal table. This option is not available on all systems; it depends upon the system's implementation of the iconv() function.

-s

suppresses all error messages about faulty encodings.

-t newset

specifies the destination code set for the output. newset can be either the code set name or a path name to a file containing an external code set.

-v

specifies verbose output. When used with -l, the list of code sets includes brief explanatory names.


EXAMPLES

To convert the file words.txt from the ISO 8859-1 standard code set to the CP 437 standard code set, and store in converted:
iconv -f ISO8859-1 -t CP437 words.txt > converted


DIAGNOSTICS

Possible exit status values are:
0

Successful completion.

1

Failure due to any of the following:

— insufficient memory
— inability to open the input file
— incorrect or unknown option
2

Input contained a character sequence which is illegal in the source code set.


PORTABILITY

-v and the ability to specify file names as arguments to -f and -t are all extensions to the XPG standard and are proposed extensions to the POSIX.2b standard. The -c, -l, and -s options are extensions to the XPG standard.


SEE ALSO

Miscellaneous:
iconv


Updated MKS Toolkit [3khat16.ico]HP3000 [3khat16.ico]3kMail [archive16.gif]