1ICONV(1)                       Linux User Manual                      ICONV(1)
2
3
4

NAME

6       iconv - convert text from one character encoding to another
7

SYNOPSIS

9       iconv [options] [-f from-encoding] [-t to-encoding] [inputfile]...
10

DESCRIPTION

12       The iconv program reads in text in one encoding and outputs the text in
13       another encoding.  If no input files are given, or if it is given as  a
14       dash (-), iconv reads from standard input.  If no output file is given,
15       iconv writes to standard output.
16
17       If no from-encoding is given, the default is derived from  the  current
18       locale's  character  encoding.  If no to-encoding is given, the default
19       is derived from the current locale's character encoding.
20

OPTIONS

22       -f from-encoding, --from-code=from-encoding
23              Use from-encoding for input characters.
24
25       -t to-encoding, --to-code=to-encoding
26              Use to-encoding for output characters.
27
28              If the string //IGNORE is appended  to  to-encoding,  characters
29              that  cannot  be converted are discarded and an error is printed
30              after conversion.
31
32              If the string //TRANSLIT is appended to to-encoding,  characters
33              being  converted  are  transliterated  when needed and possible.
34              This means that when a character cannot be  represented  in  the
35              target character set, it can be approximated through one or sev‐
36              eral similar looking characters.  Characters that are outside of
37              the  target  character  set  and  cannot  be  transliterated are
38              replaced with a question mark (?) in the output.
39
40       -l, --list
41              List all known character set encodings.
42
43       -c     Silently discard characters that cannot be converted instead  of
44              terminating when encountering such characters.
45
46       -o outputfile, --output=outputfile
47              Use outputfile for output.
48
49       -s, --silent
50              This option is ignored; it is provided only for compatibility.
51
52       --verbose
53              Print  progress  information  on  standard error when processing
54              multiple files.
55
56       -?, --help
57              Print a usage summary and exit.
58
59       --usage
60              Print a short usage summary and exit.
61
62       -V, --version
63              Print the version number, license, and  disclaimer  of  warranty
64              for iconv.
65

EXIT STATUS

67       Zero on success, nonzero on errors.
68

ENVIRONMENT

70       Internally,  the iconv program uses the iconv(3) function which in turn
71       uses gconv modules (dynamically loaded shared libraries) to convert  to
72       and  from  a character set.  Before calling iconv(3), the iconv program
73       must first allocate a conversion descriptor using  iconv_open(3).   The
74       operation  of  the  latter function is influenced by the setting of the
75       GCONV_PATH environment variable:
76
77       *  If GCONV_PATH is not set, iconv_open(3) loads the system gconv  mod‐
78          ule  configuration  cache  file  created by iconvconfig(8) and then,
79          based on the configuration, loads the gconv modules needed  to  per‐
80          form the conversion.  If the system gconv module configuration cache
81          file is not available then the  system  gconv  module  configuration
82          file is used.
83
84       *  If  GCONV_PATH  is defined (as a colon-separated list of pathnames),
85          the system gconv module configuration cache is not  used.   Instead,
86          iconv_open(3) first tries to load the configuration files by search‐
87          ing the directories in GCONV_PATH in order, followed by  the  system
88          default  gconv  module  configuration file.  If a directory does not
89          contain a gconv module configuration file, any gconv modules that it
90          may  contain  are  ignored.   If a directory contains a gconv module
91          configuration file and it is determined that  a  module  needed  for
92          this  conversion is available in the directory, then the needed mod‐
93          ule is loaded from that directory, the order  being  such  that  the
94          first  suitable  module  found  in  GCONV_PATH is used.  This allows
95          users to use custom modules and even replace system-provided modules
96          by providing such modules in GCONV_PATH directories.
97

FILES

99       /usr/lib/gconv
100              Usual default gconv module path.
101
102       /usr/lib/gconv/gconv-modules
103              Usual system default gconv module configuration file.
104
105       /usr/lib/gconv/gconv-modules.cache
106              Usual system gconv module configuration cache.
107

CONFORMING TO

109       POSIX.1-2001.
110

EXAMPLE

112       Convert text from the ISO 8859-15 character encoding to UTF-8:
113
114           $ iconv -f ISO-8859-15 -t UTF-8 < input.txt > output.txt
115
116       The  next  example  converts  from UTF-8 to ASCII, transliterating when
117       possible:
118
119           $ echo abc ß α € àḃç | iconv -f UTF-8 -t ASCII//TRANSLIT
120           abc ss ? EUR abc
121

SEE ALSO

123       locale(1), iconv(3), nl_langinfo(3), charsets(7), iconvconfig(8)
124

COLOPHON

126       This page is part of release 4.16 of the Linux  man-pages  project.   A
127       description  of  the project, information about reporting bugs, and the
128       latest    version    of    this    page,    can     be     found     at
129       https://www.kernel.org/doc/man-pages/.
130
131
132
133GNU                               2018-02-02                          ICONV(1)
Impressum