Jump to content

Iconv

From Wikipedia, the free encyclopedia

Template:Short description Template:Use dmy dates Template:Lowercase title {{#invoke:Infobox|infobox}}Template:Template other {{#invoke:Check for unknown parameters|check|unknown=Template:Main other|preview=Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y| AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo class | logo size | logo title | logo upright | logo_alt | logo_caption | logo_class | logo_size | logo_title | logo_upright | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | qid | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot class | screenshot size | screenshot title | screenshot upright | screenshot_alt | screenshot_class | screenshot_size | screenshot_upright | service_name | size | standard | title | ver layout | website }}Template:Main other{{#invoke:Check for conflicting parameters|check | template = Template:Infobox software | cat = Template:Main other | logo size; logo_size | logo class; logo_class | logo alt; logo_alt | logo title; logo_title | logo caption; logo_caption | screenshot size; screenshot_size | screenshot upright; screenshot_upright | screenshot class; screenshot_class | screenshot alt; screenshot_alt | screenshot title; screenshot title | latest release version; latest_release_version | latest release date; latest_release_date | latest preview version; latest_preview_version | latest preview date; latest_preview_date | latest release version; latest_release_version | latest release date; latest_release_date | latest preview version; latest_preview_version | latest preview date; latest_preview_date | programming language; programming_language | operating system; operating_system }} In Unix and Unix-like operating systems, iconv (an abbreviation of internationalization conversion)[1] is a command-line program[2] and a standardized application programming interface (API)[3] used to convert between different character encodings. "It can convert from any of these encodings to any other, through Unicode conversion."[4]

History

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

Implementations

Most Linux distributions provide an implementation, either from the GNU 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[6] 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.[7] 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, which first appeared in December 2004.

The musl C library implements the iconv function with support for all encodings specified by the WHATWG Encoding Standard.

Support

Currently, over a hundred different character encodings are supported in the GNU variant.[4]

Ports

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

The Template:Mono command has also been ported to the IBM i operating system.[11]

Usage

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

<syntaxhighlight lang="bash"> iconv -f iso-8859-1 </syntaxhighlight>

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

<syntaxhighlight lang="bash"> iconv -f iso-8859-1 -t utf-8 <infile> -o <outfile> </syntaxhighlight>

See also

References

Template:Reflist

Template:Sister project

Template:Unix commands Template:Hewlett-Packard software

  1. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  2. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  3. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  4. ↑ 4.0 4.1 {{#invoke:citation/CS1|citation |CitationClass=web }}
  5. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  6. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  7. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  8. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  9. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  10. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  11. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  12. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}