]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man1/iconv.1
man*/: ffix (Use '.TQ' where appropriate)
[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.\"
4c1c5274 5.TH iconv 1 (date) "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
6fdb1c03
AC
65.B \-l
66.TQ
67.B \-\-list
111cf06c
MM
68List all known character set encodings.
69.TP
6fdb1c03 70.B \-c
111cf06c 71Silently discard characters that cannot be converted instead of
3b1d2abe 72terminating when encountering such characters.
111cf06c 73.TP
6fdb1c03
AC
74.BI \-o\~ outputfile
75.TQ
76.BI \-\-output= outputfile
111cf06c
MM
77Use
78.I outputfile
79for output.
80.TP
6fdb1c03
AC
81.B \-s
82.TQ
83.B \-\-silent
3b1d2abe 84This option is ignored; it is provided only for compatibility.
111cf06c 85.TP
6fdb1c03 86.B \-\-verbose
111cf06c
MM
87Print progress information on standard error when processing
88multiple files.
89.TP
6fdb1c03
AC
90.B \-?
91.TQ
92.B \-\-help
111cf06c
MM
93Print a usage summary and exit.
94.TP
6fdb1c03 95.B \-\-usage
111cf06c
MM
96Print a short usage summary and exit.
97.TP
6fdb1c03
AC
98.B \-V
99.TQ
100.B \-\-version
111cf06c
MM
101Print the version number, license, and disclaimer of warranty for
102.BR iconv .
103.SH EXIT STATUS
777411ae 104Zero on success, nonzero on errors.
111cf06c
MM
105.SH ENVIRONMENT
106Internally, the
107.B iconv
108program uses the
109.BR iconv (3)
110function which in turn uses
111.I gconv
7a1c8f56
MK
112modules (dynamically loaded shared libraries)
113to convert to and from a character set.
114Before calling
115.BR iconv (3),
91085d85 116the
111cf06c 117.B iconv
7a1c8f56
MK
118program must first allocate a conversion descriptor using
119.BR iconv_open (3).
120The operation of the latter function is influenced by the setting of the
111cf06c 121.B GCONV_PATH
7a1c8f56 122environment variable:
cdede5cd 123.IP \[bu] 3
7a1c8f56
MK
124If
125.B GCONV_PATH
126is not set,
127.BR iconv_open (3)
538ca136 128loads the system gconv module configuration cache file created by
7a1c8f56
MK
129.BR iconvconfig (8)
130and then, based on the configuration,
131loads the gconv modules needed to perform the conversion.
538ca136
MM
132If the system gconv module configuration cache file is not available
133then the system gconv module configuration file is used.
cdede5cd 134.IP \[bu]
111cf06c
MM
135If
136.B GCONV_PATH
7a1c8f56
MK
137is defined (as a colon-separated list of pathnames),
138the system gconv module configuration cache is not used.
139Instead,
140.BR iconv_open (3)
dfdbfcae 141first tries to load the configuration files by searching the directories in
a28b73cd 142.B GCONV_PATH
dfdbfcae
MK
143in order,
144followed by the system default gconv module configuration file.
7a1c8f56
MK
145If a directory does not contain a gconv module configuration file,
146any gconv modules that it may contain are ignored.
147If a directory contains a gconv module configuration file
148and it is determined that a module needed for this conversion is
149available in the directory,
150then the needed module is loaded from that directory,
151the order being such that the first suitable module found in
152.B GCONV_PATH
153is used.
154This allows users to use custom modules and even replace system-provided
155modules by providing such modules in
156.B GCONV_PATH
157directories.
111cf06c
MM
158.SH FILES
159.TP
160.I /usr/lib/gconv
161Usual default gconv module path.
162.TP
20810608 163.I /usr/lib/gconv/gconv\-modules
538ca136 164Usual system default gconv module configuration file.
111cf06c 165.TP
20810608 166.I /usr/lib/gconv/gconv\-modules.cache
538ca136 167Usual system gconv module configuration cache.
111ccf7e
MK
168.PP
169Depending on the architecture,
170the above files may instead be located at directories with the path prefix
171.IR /usr/lib64 .
3113c7f3 172.SH STANDARDS
4131356c
AC
173POSIX.1-2008.
174.SH HISTORY
111cf06c 175POSIX.1-2001.
a14af333 176.SH EXAMPLES
3b1d2abe 177Convert text from the ISO 8859-15 character encoding to UTF-8:
2a86152e 178.PP
3b1d2abe 179.in +4n
60d3774e 180.EX
20810608 181$ \fBiconv \-f ISO\-8859\-15 \-t UTF\-8 < input.txt > output.txt\fP
60d3774e 182.EE
3b1d2abe 183.in
111cf06c
MM
184.PP
185The next example converts from UTF-8 to ASCII, transliterating when
186possible:
2a86152e 187.PP
3b1d2abe 188.in +4n
60d3774e 189.EX
3b1d2abe 190$ \fBecho abc ß α € àḃç | iconv \-f UTF\-8 \-t ASCII//TRANSLIT\fP
111cf06c 191abc ss ? EUR abc
60d3774e 192.EE
3b1d2abe 193.in
d282bb24 194.SH SEE ALSO
111cf06c 195.BR locale (1),
2e51e29c 196.BR uconv (1),
111cf06c
MM
197.BR iconv (3),
198.BR nl_langinfo (3),
199.BR charsets (7),
200.BR iconvconfig (8)