1iconv(1) User Commands iconv(1)
2
3
4
6 iconv - code set conversion utility
7
9 iconv [-cs] -f frommap -t tomap [file]...
10
11
12 iconv -f fromcode [-cs] [-t tocode] [file]...
13
14
15 iconv -t tocode [-cs] [-f fromcode] [file]...
16
17
18 iconv -l
19
20
22 The iconv utility converts the characters or sequences of characters in
23 file from one code set to another and writes the results to standard
24 output. If no conversion exists for a particular character, an imple‐
25 mentation-defined conversion is performed on this character.
26
27
28 The list of supported conversions and the locations of the associated
29 conversion tables are provided in the iconv(5) manual page.
30
32 The following options are supported:
33
34 -c Omits any characters that are invalid in the codeset
35 of the input file from the output. When -c is not
36 used, the results of encountering invalid characters
37 in the input stream depend on the specified codesets
38 for the conversion. Invalid characters can be either
39 those that are not valid characters in the codeset of
40 the input file or those that have no corresponding
41 character in the codeset of the output file. The
42 presence or absence of -c does not affect the exit
43 status of iconv. When fromcode is specified for the
44 fromcodeset of the -f option or tocode is specified
45 for the tocodeset of the -t option, the specification
46 of -c may be ignored.
47
48
49 -f fromcodeset Identifies the code set of the input file. The fol‐
50 lowing two forms of the fromcodeset option-argument
51 are recognized:
52
53 fromcode The fromcode option-argument must not
54 contain a slash (/) character. It is
55 interpreted as the name of one of the
56 codeset descriptions.
57
58
59 frommap The frommap option-argument must contain
60 a slash character. It is interpreted as
61 the pathname of a charmap file as defined
62 in charmap(5). If the pathname does not
63 represent a valid, readable charmap file,
64 the results are undefined.
65
66 If this option is omitted, the codeset of the current
67 locale is used.
68
69
70 -l Writes all supported fromcode and tocode values to
71 standard output.
72
73
74 -s Suppresses any messages written to standard error
75 concerning invalid characters. When -s is not used,
76 the results of encountering invalid characters in the
77 input stream depend on the specified codesets for the
78 conversion. Invalid characters can be either those
79 that are not valid characters in the codeset of the
80 input file or those that have no corresponding char‐
81 acter in the codeset of the output file. The presence
82 or absence of -s does not affect the exit status of
83 iconv. When fromcode is specified for the from‐
84 codeset of the -f option or tocode is specified for
85 the tocodeset of the -t option, the specification of
86 -s may be ignored.
87
88
89 -t tocodeset Identifies the code set used for the output file. The
90 following two forms of the tocodeset option-argument
91 are recognized:
92
93 tocode The tocode option-argument must not contain
94 a slash (/) character. It is inter‐
95 preted as the name of one of the codeset
96 descriptions.
97
98
99 tomap The tomap option-argument must contain a
100 slash character. It is interpreted as the
101 pathname of a charmap file as defined in
102 charmap(5). If the pathname does not repre‐
103 sent a valid, readable charmap file, the
104 results are undefined.
105
106 If this option is omitted, the codeset of the current
107 locale is used.
108
109
110
111 If either -f or -t represents a charmap file but the other does not, or
112 is omitted, or if both -f and -t are omitted, iconv fails as an error.
113
115 The following operands are supported:
116
117 file A path name of an input file. If no file operands are speci‐
118 fied, or if a file operand is '-', the standard input is used.
119
120
122 Example 1 Converting and storing files
123
124
125 The following example converts the contents of file mail1 from code set
126 8859 to 646fr and stores the results in file mail.local:
127
128
129 example% iconv -f 8859 -t 646fr mail1 > mail.local
130
131
132
134 See environ(5) for descriptions of the following environment variables
135 that affect the execution of iconv: LANG, LC_ALL, LC_CTYPE, LC_MES‐
136 SAGES, and NLSPATH.
137
139 The following exit values are returned:
140
141 0 Successful completion.
142
143
144 1 An error has occurred.
145
146
148 /usr/lib/iconv/iconv_data list of conversions supported by conver‐
149 sion tables
150
151
153 See attributes(5) for descriptions of the following attributes:
154
155
156
157
158 ┌─────────────────────────────┬─────────────────────────────┐
159 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
160 ├─────────────────────────────┼─────────────────────────────┤
161 │Availability │SUNWcsu │
162 ├─────────────────────────────┼─────────────────────────────┤
163 │Interface Stability │Standard │
164 └─────────────────────────────┴─────────────────────────────┘
165
167 iconv(3C), iconv_open(3C), attributes(5), charmap(5), environ(5),
168 iconv(5), iconv_unicode(5), standards(5)
169
171 Make sure that both charmap files use the same symbolic names for char‐
172 acters the two codesets have in common.
173
174
175 The output format of the -l option is unspecified. The -l option is not
176 intended for shell script usage.
177
178
179 When fromcode or tocode is specified for the codeset conversion, iconv
180 uses the iconv_open(3C) function. If iconv_open(3C) fails to open the
181 specified codeset conversion, iconv searches for an appropriate conver‐
182 sion table. As for the supported codeset conversion by iconv_open(3C),
183 please refer to iconv(5) and iconv_locale(5).
184
185
186
187SunOS 5.11 14 Nov 2003 iconv(1)