iconv
iconv is a computer program and a standardized application programming interface (API) used to convert between different character encodings.[1] "It can convert from any of these encodings to any other, through Unicode conversion."[2]
History
The iconv API is the standard programming interface for converting character strings from one character encoding to another in Unix-like operating systems.
Initially appearing on the HP-UX operating system,[3] it was standardized within XPG4 and is part of the Single UNIX Specification (SUS).
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.[2] The library's iconv() function is licensed as LGPL, so it is linkable with closed source applications, while the iconv utility is licensed as GPL, so derivatives must be open and in GPL too. 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.[2]
Usage
stdin
can be converted from ISO-8859-1 to current locale and output to stdout
using:[4]
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 <infile >outfile
Ports
Under Microsoft Windows, the iconv binary (and thus, likely also the API) is provided by the Cygwin and GnuWin32 environments or native Win32 port win_iconv.exe.[5]
iconv is also available for many programming languages. For example, one of the libraries supported by PHP[6] (also under Windows using a DLL file), so it is possible to use iconv() from a PHP program easily.
See also
References
External links
|