Puneet Varma (Editor)

Iconv

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

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

Contents

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 (SUS).

Implementations

All recent Linux distributions contain a free implementation of iconv utility and iconv() function as part of the GNU C Library which is the C library for current Linux systems. The library's iconv() function as well as the utility is licensed as LGPL, so it is linkable with closed source applications. To use the library, the GNU glibc locales need to be installed, which are provided as a separate package (usually named glibc-locale) normally installed by default.

GNU also provides a separate iconv implementation in its "libiconv" package. Unlike the glibc implementation, the utility in "libiconv" is licensed under GPL, so derivatives must be open in GPL too. This separate implementation can be seen in non-glibc platforms that still need iconv functionalities like Cygwin and GnuWin32.

The uconv utility from International Components for Unicode provides an iconv-compatible command-line syntax for transcoding.

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:

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

References

Iconv Wikipedia


Similar Topics