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