In
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
and
Unix-like
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating systems, iconv (an abbreviation of
internationalization
In economics, internationalization or internationalisation is the process of increasing involvement of enterprises in international markets, although there is no agreed definition of internationalization. Internationalization is a crucial strateg ...
conversion) is a command-line
program and a standardized
application programming interface (API) used to convert between different
character encoding
Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using digital computers. The numerical values tha ...
s. "It can convert from any of these encodings to any other, through Unicode conversion."
History
Initially appearing on the
HP-UX
HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984. Current versions support HPE Integrit ...
operating system,
iconv()
as well as the utility was standardized within
XPG4 X/Open group (also known as the Open Group for Unix Systems and incorporated in 1987 as X/Open Company, Ltd.) was a consortium founded by several European UNIX systems manufacturers in 1984 to identify and promote open standards in the field of inf ...
and is part of the
Single UNIX Specification (SUS).
Implementations
Most
Linux distribution
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading on ...
s provide an implementation, either from the
GNU
GNU () is an extensive collection of free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any ...
Standard C Library (included since version 2.1, February 1999), 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
The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the four freedoms to run, study, share, and modify the software. The license was the first copyleft for general us ...
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
In computing, uconv is a command-line tool that is bundled with International Components for Unicode that converts text files between different character encodings. It is very similar to the '' iconv'' command that is part of the Single UNIX Speci ...
utility from
International Components for Unicode
International Components for Unicode (ICU) is an open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or cont ...
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
Cygwin ( ) is a POSIX-compatible programming and runtime environment that runs natively on Microsoft Windows. Under Cygwin, source code designed for Unix-like operating systems may be compiled with minimal modification and executed.
The Cygwin i ...
and
GnuWin32
The G''nu''W''in''32 project provides native ports in the form of executable computer programs, patches, and source code for various GNU and open source tools and software, much of it modified to run on the 32-bit Windows platform. The ports in ...
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.
The command has also been ported to the
IBM i
IBM i (the ''i'' standing for ''integrated'') is an operating system developed by IBM for IBM Power Systems. It was originally released in 1988 as OS/400, as the sole operating system of the IBM AS/400 line of systems. It was renamed to i5/OS i ...
operating system.
Usage
stdin
In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
can be converted from
ISO-8859-1
ISO/IEC 8859-1:1998, ''Information technology — 8-bit single-byte coded graphic character sets — Part 1: Latin alphabet No. 1'', is part of the ISO/IEC 8859 series of ASCII-based standard character encodings, first edition published in ...
to current locale and output to
stdout
In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
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 -o
See also
*
uconv
In computing, uconv is a command-line tool that is bundled with International Components for Unicode that converts text files between different character encodings. It is very similar to the '' iconv'' command that is part of the Single UNIX Speci ...
*
luit
luit is a utility program used to translate the character set of a computer program so that its output can be displayed correctly on a terminal emulator that uses a different character set. Whereas iconv converts the character set of string ...
*
List of Unix commands
This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems.
List
See also
* List of G ...
*
International Components for Unicode
International Components for Unicode (ICU) is an open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or cont ...
References
External links
iconv() OpenGroup Standards pageGNU libiconvwin_iconv
HP software
Unix text processing utilities
Unix SUS2008 utilities
IBM i Qshell commands
C POSIX library
{{Unix-stub