]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man1/iconv.1
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man1 / iconv.1
CommitLineData
111cf06c
MM
1.\" Copyright (C) 2014 Marko Myllynen <myllynen@redhat.com>
2.\"
e4a74ca8 3.\" SPDX-License-Identifier: GPL-2.0-or-later
111cf06c 4.\"
45186a5d 5.TH ICONV 1 2021-08-27 "Linux man-pages (unreleased)"
111cf06c
MM
6.SH NAME
7iconv \- convert text from one character encoding to another
8.SH SYNOPSIS
9.B iconv
10.RI [ options ]
20810608
JW
11.RI "[\-f " from-encoding "]"
12.RI "[\-t " to-encoding "]"
111cf06c
MM
13.RI [ inputfile ]...
14.SH DESCRIPTION
15The
16.B iconv
17program reads in text in one encoding and outputs the text in another
18encoding.
19If no input files are given, or if it is given as a dash (\-),
20.B iconv
3b1d2abe 21reads from standard input.
111cf06c
MM
22If no output file is given,
23.B iconv
3b1d2abe 24writes to standard output.
111cf06c
MM
25.PP
26If no
27.I from-encoding
28is given, the default is derived
29from the current locale's character encoding.
30If no
31.I to-encoding
32is given, the default is derived
33from the current locale's character
34encoding.
35.SH OPTIONS
36.TP
2e621720 37.BI \-f " from-encoding" "\fR, \fP\-\-from\-code=" from-encoding
111cf06c
MM
38Use
39.I from-encoding
40for input characters.
41.TP
2e621720 42.BI \-t " to-encoding" "\fR, \fP\-\-to\-code=" to-encoding
111cf06c
MM
43Use
44.I to-encoding
45for output characters.
2a86152e 46.IP
3b1d2abe 47If the string
a28b73cd 48.B //IGNORE
3b1d2abe
MK
49is appended to
50.IR to-encoding ,
111cf06c
MM
51characters that cannot be converted are discarded and an error is
52printed after conversion.
2a86152e 53.IP
3b1d2abe 54If the string
a28b73cd 55.B //TRANSLIT
3b1d2abe
MK
56is appended to
57.IR to-encoding ,
111cf06c 58characters being converted are transliterated when needed and possible.
3b1d2abe
MK
59This means that when a character cannot be represented in the target
60character set, it can be approximated through one or several similar
111cf06c
MM
61looking characters.
62Characters that are outside of the target character set and cannot be
63transliterated are replaced with a question mark (?) in the output.
64.TP
fb787570 65.BR \-l ", " \-\-list
111cf06c
MM
66List all known character set encodings.
67.TP
68.B "\-c"
69Silently discard characters that cannot be converted instead of
3b1d2abe 70terminating when encountering such characters.
111cf06c 71.TP
2e621720 72.BI \-o " outputfile" "\fR, \fP\-\-output=" outputfile
111cf06c
MM
73Use
74.I outputfile
75for output.
76.TP
fb787570 77.BR \-s ", " \-\-silent
3b1d2abe 78This option is ignored; it is provided only for compatibility.
111cf06c
MM
79.TP
80.B "\-\-verbose"
81Print progress information on standard error when processing
82multiple files.
83.TP
fb787570 84.BR \-? ", " \-\-help
111cf06c
MM
85Print a usage summary and exit.
86.TP
87.B "\-\-usage"
88Print a short usage summary and exit.
89.TP
fb787570 90.BR \-V ", " \-\-version
111cf06c
MM
91Print the version number, license, and disclaimer of warranty for
92.BR iconv .
93.SH EXIT STATUS
777411ae 94Zero on success, nonzero on errors.
111cf06c
MM
95.SH ENVIRONMENT
96Internally, the
97.B iconv
98program uses the
99.BR iconv (3)
100function which in turn uses
101.I gconv
7a1c8f56
MK
102modules (dynamically loaded shared libraries)
103to convert to and from a character set.
104Before calling
105.BR iconv (3),
91085d85 106the
111cf06c 107.B iconv
7a1c8f56
MK
108program must first allocate a conversion descriptor using
109.BR iconv_open (3).
110The operation of the latter function is influenced by the setting of the
111cf06c 111.B GCONV_PATH
7a1c8f56
MK
112environment variable:
113.IP * 3
114If
115.B GCONV_PATH
116is not set,
117.BR iconv_open (3)
538ca136 118loads the system gconv module configuration cache file created by
7a1c8f56
MK
119.BR iconvconfig (8)
120and then, based on the configuration,
121loads the gconv modules needed to perform the conversion.
538ca136
MM
122If the system gconv module configuration cache file is not available
123then the system gconv module configuration file is used.
7a1c8f56 124.IP *
111cf06c
MM
125If
126.B GCONV_PATH
7a1c8f56
MK
127is defined (as a colon-separated list of pathnames),
128the system gconv module configuration cache is not used.
129Instead,
130.BR iconv_open (3)
dfdbfcae 131first tries to load the configuration files by searching the directories in
a28b73cd 132.B GCONV_PATH
dfdbfcae
MK
133in order,
134followed by the system default gconv module configuration file.
7a1c8f56
MK
135If a directory does not contain a gconv module configuration file,
136any gconv modules that it may contain are ignored.
137If a directory contains a gconv module configuration file
138and it is determined that a module needed for this conversion is
139available in the directory,
140then the needed module is loaded from that directory,
141the order being such that the first suitable module found in
142.B GCONV_PATH
143is used.
144This allows users to use custom modules and even replace system-provided
145modules by providing such modules in
146.B GCONV_PATH
147directories.
111cf06c
MM
148.SH FILES
149.TP
150.I /usr/lib/gconv
151Usual default gconv module path.
152.TP
20810608 153.I /usr/lib/gconv/gconv\-modules
538ca136 154Usual system default gconv module configuration file.
111cf06c 155.TP
20810608 156.I /usr/lib/gconv/gconv\-modules.cache
538ca136 157Usual system gconv module configuration cache.
111ccf7e
MK
158.PP
159Depending on the architecture,
160the above files may instead be located at directories with the path prefix
161.IR /usr/lib64 .
3113c7f3 162.SH STANDARDS
111cf06c 163POSIX.1-2001.
a14af333 164.SH EXAMPLES
3b1d2abe 165Convert text from the ISO 8859-15 character encoding to UTF-8:
2a86152e 166.PP
3b1d2abe 167.in +4n
60d3774e 168.EX
20810608 169$ \fBiconv \-f ISO\-8859\-15 \-t UTF\-8 < input.txt > output.txt\fP
60d3774e 170.EE
3b1d2abe 171.in
111cf06c
MM
172.PP
173The next example converts from UTF-8 to ASCII, transliterating when
174possible:
2a86152e 175.PP
3b1d2abe 176.in +4n
60d3774e 177.EX
3b1d2abe 178$ \fBecho abc ß α € àḃç | iconv \-f UTF\-8 \-t ASCII//TRANSLIT\fP
111cf06c 179abc ss ? EUR abc
60d3774e 180.EE
3b1d2abe 181.in
d282bb24 182.SH SEE ALSO
111cf06c 183.BR locale (1),
2e51e29c 184.BR uconv (1),
111cf06c
MM
185.BR iconv (3),
186.BR nl_langinfo (3),
187.BR charsets (7),
188.BR iconvconfig (8)