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. (On Windows systems, this is ROOTDIR/etc/iconv.)

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

FILES

ROOTDIR/etc/iconv 

Directory searched for external code set files on Windows systems. These external code set files must have the character table in byte-reversed (little endian) order.


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

Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

-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.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Miscellaneous:
iconv


PTC MKS Toolkit 10.4 Documentation Build 39.