Iconv


In Unix-like operating systems, iconv is a command-line program and a standardized application programming interface used to convert between different character encodings. "It can convert from any of these encodings to any other, through Unicode conversion."

History

Initially appearing on the HP-UX operating system,iconv as well as the utility was standardized within XPG4 and is part of the Single UNIX Specification.

Implementations

Most Linux distributions provide an implementation, either from the GNU Standard C Library, or the more traditional GNU libiconv, for systems based on other Standard C Libraries.
The iconv function on both is licensed as LGPL, so it is linkable with closed source applications.
Unlike the libraries, the iconv utility is licensed under GPL in both implementations.
The GNU libiconv implementation is portable, and can be used on various UNIX-like and non-UNIX systems. Version 0.3 dates from December 1999.
The uconv utility from International Components for Unicode provides an iconv-compatible command-line syntax for transcoding.
Most BSD systems use NetBSD's implementation, first appeared in December 2004.

Support

Currently, over a hundred different character encodings are supported.

Ports

Under Microsoft Windows, the iconv library and the utility is provided by GNU's libiconv found in Cygwin and GnuWin32 environments; there is also a "purely Win32" implementation called "win-iconv" that uses Windows' built-in routines for conversion. The iconv function is also available for many programming languages.

Usage

stdin can be converted from ISO-8859-1 to current locale and output to stdout using:

iconv -f iso-8859-1

An input file infile can be converted from ISO-8859-1 to UTF-8 and output to output file outfile using:

iconv -f iso-8859-1 -t utf-8 outfile