isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

iconv.html (14710B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>iconv</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/head.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/id.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
     19 </tr>
     20 </table>
     21 <hr align="left" width="100%"></div>
     22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     23 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     24 IEEE Std 1003.1-2024<br>
     25 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     26 <hr size="2" noshade>
     27 <a name="top" id="top"></a> <a name="iconv" id="iconv"></a> <a name="tag_20_58" id="tag_20_58"></a><!-- iconv -->
     28 <h4 class="mansect"><a name="tag_20_58_01" id="tag_20_58_01"></a>NAME</h4>
     29 <blockquote>iconv — codeset conversion</blockquote>
     30 <h4 class="mansect"><a name="tag_20_58_02" id="tag_20_58_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <p><code><tt>iconv</tt> <b>[</b><tt>-cs</tt><b>]</b> <tt>-f</tt> <i>frommap</i> <tt>-t</tt> <i>tomap</i>
     33 <b>[</b><i>file</i><tt>...</tt><b>]</b> <tt><br>
     34 <br>
     35 iconv -f</tt> <i>fromcode</i> <b>[</b><tt>-cs</tt><b>] [</b><tt>-t</tt> <i>tocode</i><b>] [</b><i>file</i><tt>...</tt><b>]</b>
     36 <tt><br>
     37 <br>
     38 iconv -t</tt> <i>tocode</i> <b>[</b><tt>-cs</tt><b>] [</b><tt>-f</tt> <i>fromcode</i><b>] [</b><i>file</i><tt>...</tt><b>]</b>
     39 <tt><br>
     40 <br>
     41 iconv -l<br></tt></code></p>
     42 </blockquote>
     43 <h4 class="mansect"><a name="tag_20_58_03" id="tag_20_58_03"></a>DESCRIPTION</h4>
     44 <blockquote>
     45 <p>The <i>iconv</i> utility shall convert the encoding of characters in <i>file</i> from one codeset to another and write the
     46 results to standard output.</p>
     47 <p>When the options indicate that charmap files are used to specify the codesets (see OPTIONS), the codeset conversion shall be
     48 accomplished by performing a logical join on the symbolic character names in the two charmaps. The implementation need not support
     49 the use of charmap files for codeset conversion unless the POSIX2_LOCALEDEF symbol is defined on the system.</p>
     50 </blockquote>
     51 <h4 class="mansect"><a name="tag_20_58_04" id="tag_20_58_04"></a>OPTIONS</h4>
     52 <blockquote>
     53 <p>The <i>iconv</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     54 Guidelines</i></a> .</p>
     55 <p>The following options shall be supported:</p>
     56 <dl compact>
     57 <dd></dd>
     58 <dt><b>-c</b></dt>
     59 <dd>Omit any characters that are invalid in the codeset of the input file from the output. When <b>-c</b> is not used, the results
     60 of encountering invalid characters in the input stream (either those that are not characters in the codeset of the input file or
     61 that have no corresponding character in the codeset of the output file) shall be specified in the system documentation. The
     62 presence or absence of <b>-c</b> shall not affect the exit status of <i>iconv</i>.</dd>
     63 <dt><b>-f&nbsp;</b><i>fromcodeset</i></dt>
     64 <dd><br>
     65 Identify the codeset of the input file. The implementation shall recognize the following two forms of the <i>fromcodeset</i>
     66 option-argument:
     67 <dl compact>
     68 <dd></dd>
     69 <dt><i>fromcode</i></dt>
     70 <dd>The <i>fromcode</i> option-argument can not contain a &lt;slash&gt; character. It shall be interpreted as the name of one of
     71 the codeset descriptions provided by the implementation in an unspecified format. Valid values of <i>fromcode</i> are
     72 implementation-defined.</dd>
     73 <dt><i>frommap</i></dt>
     74 <dd>The <i>frommap</i> option-argument needs to contain a &lt;slash&gt; character. It shall be interpreted as the pathname of a
     75 charmap file as defined in XBD <a href="../basedefs/V1_chap06.html#tag_06_04"><i>6.4 Character Set Description File</i></a> . If
     76 the pathname does not represent a valid, readable charmap file, the results are undefined.</dd>
     77 </dl>
     78 <p>If this option is omitted, the codeset of the current locale shall be used.</p>
     79 </dd>
     80 <dt><b>-l</b></dt>
     81 <dd>Write all supported <i>fromcode</i> and <i>tocode</i> values to standard output in an unspecified format.</dd>
     82 <dt><b>-s</b></dt>
     83 <dd>Suppress any messages written to standard error concerning invalid characters. When <b>-s</b> is not used, the results of
     84 encountering invalid characters in the input stream (either those that are not valid characters in the codeset of the input file or
     85 that have no corresponding character in the codeset of the output file) shall be specified in the system documentation. The
     86 presence or absence of <b>-s</b> shall not affect the exit status of <i>iconv</i>.</dd>
     87 <dt><b>-t&nbsp;</b><i>tocodeset</i></dt>
     88 <dd>Identify the codeset to be used for the output file. The implementation shall recognize the following two forms of the
     89 <i>tocodeset</i> option-argument:
     90 <dl compact>
     91 <dd></dd>
     92 <dt><i>tocode</i></dt>
     93 <dd>The semantics shall be equivalent to the <b>-f</b> <i>fromcode</i> option.</dd>
     94 <dt><i>tomap</i></dt>
     95 <dd>The semantics shall be equivalent to the <b>-f</b> <i>frommap</i> option.</dd>
     96 </dl>
     97 <p>If this option is omitted, the codeset of the current locale shall be used.</p>
     98 </dd>
     99 </dl>
    100 <p>If either <b>-f</b> or <b>-t</b> represents a charmap file, but the other does not (or is omitted), or both <b>-f</b> and
    101 <b>-t</b> are omitted, the results are undefined.</p>
    102 </blockquote>
    103 <h4 class="mansect"><a name="tag_20_58_05" id="tag_20_58_05"></a>OPERANDS</h4>
    104 <blockquote>
    105 <p>The following operand shall be supported:</p>
    106 <dl compact>
    107 <dd></dd>
    108 <dt><i>file</i></dt>
    109 <dd>A pathname of an input file. If no <i>file</i> operands are specified, or if a <i>file</i> operand is <tt>'-'</tt>, the
    110 standard input shall be used.</dd>
    111 </dl>
    112 </blockquote>
    113 <h4 class="mansect"><a name="tag_20_58_06" id="tag_20_58_06"></a>STDIN</h4>
    114 <blockquote>
    115 <p>The standard input shall be used only if no <i>file</i> operands are specified, or if a <i>file</i> operand is <tt>'-'</tt>.</p>
    116 </blockquote>
    117 <h4 class="mansect"><a name="tag_20_58_07" id="tag_20_58_07"></a>INPUT FILES</h4>
    118 <blockquote>
    119 <p>The input file shall be a text file.</p>
    120 </blockquote>
    121 <h4 class="mansect"><a name="tag_20_58_08" id="tag_20_58_08"></a>ENVIRONMENT VARIABLES</h4>
    122 <blockquote>
    123 <p>The following environment variables shall affect the execution of <i>iconv</i>:</p>
    124 <dl compact>
    125 <dd></dd>
    126 <dt><i>LANG</i></dt>
    127 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
    128 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
    129 variables used to determine the values of locale categories.)</dd>
    130 <dt><i>LC_ALL</i></dt>
    131 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    132 <dt><i>LC_CTYPE</i></dt>
    133 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    134 opposed to multi-byte characters in arguments). During translation of the file, this variable is superseded by the use of the
    135 <i>fromcode</i> option-argument.</dd>
    136 <dt><i>LC_MESSAGES</i></dt>
    137 <dd><br>
    138 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
    139 <dt><i>NLSPATH</i></dt>
    140 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    141 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    142 "0"></dd>
    143 </dl>
    144 </blockquote>
    145 <h4 class="mansect"><a name="tag_20_58_09" id="tag_20_58_09"></a>ASYNCHRONOUS EVENTS</h4>
    146 <blockquote>
    147 <p>Default.</p>
    148 </blockquote>
    149 <h4 class="mansect"><a name="tag_20_58_10" id="tag_20_58_10"></a>STDOUT</h4>
    150 <blockquote>
    151 <p>When the <b>-l</b> option is used, the standard output shall contain all supported <i>fromcode</i> and <i>tocode</i> values,
    152 written in an unspecified format.</p>
    153 <p>When the <b>-l</b> option is not used, the standard output shall contain the sequence of characters read from the input files,
    154 translated to the specified codeset. Nothing else shall be written to the standard output.</p>
    155 </blockquote>
    156 <h4 class="mansect"><a name="tag_20_58_11" id="tag_20_58_11"></a>STDERR</h4>
    157 <blockquote>
    158 <p>The standard error shall be used only for diagnostic messages.</p>
    159 </blockquote>
    160 <h4 class="mansect"><a name="tag_20_58_12" id="tag_20_58_12"></a>OUTPUT FILES</h4>
    161 <blockquote>
    162 <p>None.</p>
    163 </blockquote>
    164 <h4 class="mansect"><a name="tag_20_58_13" id="tag_20_58_13"></a>EXTENDED DESCRIPTION</h4>
    165 <blockquote>
    166 <p>None.</p>
    167 </blockquote>
    168 <h4 class="mansect"><a name="tag_20_58_14" id="tag_20_58_14"></a>EXIT STATUS</h4>
    169 <blockquote>
    170 <p>The following exit values shall be returned:</p>
    171 <dl compact>
    172 <dd></dd>
    173 <dt>&nbsp;0</dt>
    174 <dd>Successful completion.</dd>
    175 <dt>&gt;0</dt>
    176 <dd>An error occurred.</dd>
    177 </dl>
    178 </blockquote>
    179 <h4 class="mansect"><a name="tag_20_58_15" id="tag_20_58_15"></a>CONSEQUENCES OF ERRORS</h4>
    180 <blockquote>
    181 <p>Default.</p>
    182 </blockquote>
    183 <hr>
    184 <div class="box"><em>The following sections are informative.</em></div>
    185 <h4 class="mansect"><a name="tag_20_58_16" id="tag_20_58_16"></a>APPLICATION USAGE</h4>
    186 <blockquote>
    187 <p>The user must ensure that both charmap files use the same symbolic names for characters the two codesets have in common.</p>
    188 </blockquote>
    189 <h4 class="mansect"><a name="tag_20_58_17" id="tag_20_58_17"></a>EXAMPLES</h4>
    190 <blockquote>
    191 <p>The following example converts the contents of file <b>mail.x400</b> from the ISO/IEC&nbsp;6937:2001 standard codeset to the
    192 ISO/IEC&nbsp;8859-1:1998 standard codeset, and stores the results in file <b>mail.local</b>:</p>
    193 <pre>
    194 <tt>iconv -f IS6937 -t IS8859 mail.x400 &gt; mail.local
    195 </tt></pre></blockquote>
    196 <h4 class="mansect"><a name="tag_20_58_18" id="tag_20_58_18"></a>RATIONALE</h4>
    197 <blockquote>
    198 <p>The <i>iconv</i> utility can be used portably only when the user provides two charmap files as option-arguments. This is because
    199 a single charmap provided by the user cannot reliably be joined with the names in a system-provided character set description. The
    200 valid values for <i>fromcode</i> and <i>tocode</i> are implementation-defined and do not have to have any relation to the charmap
    201 mechanisms. As an aid to interactive users, the <b>-l</b> option was adopted from the Plan 9 operating system. It writes
    202 information concerning these implementation-defined values. The format is unspecified because there are many possible useful
    203 formats that could be chosen, such as a matrix of valid combinations of <i>fromcode</i> and <i>tocode</i>. The <b>-l</b> option is
    204 not intended for shell script usage; conforming applications will have to use charmaps.</p>
    205 <p>The <i>iconv</i> utility may support the conversion between ASCII and EBCDIC-based encodings, but is not required to do so. In
    206 an XSI-compliant implementation, the <a href="../utilities/dd.html"><i>dd</i></a> utility is the only method guaranteed to support
    207 conversion between these two character sets.</p>
    208 </blockquote>
    209 <h4 class="mansect"><a name="tag_20_58_19" id="tag_20_58_19"></a>FUTURE DIRECTIONS</h4>
    210 <blockquote>
    211 <p>None.</p>
    212 </blockquote>
    213 <h4 class="mansect"><a name="tag_20_58_20" id="tag_20_58_20"></a>SEE ALSO</h4>
    214 <blockquote>
    215 <p><a href="../utilities/dd.html#"><i>dd</i></a> , <a href="../utilities/gencat.html#"><i>gencat</i></a></p>
    216 <p>XBD <a href="../basedefs/V1_chap06.html#tag_06_04"><i>6.4 Character Set Description File</i></a> , <a href=
    217 "../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2
    218 Utility Syntax Guidelines</i></a></p>
    219 </blockquote>
    220 <h4 class="mansect"><a name="tag_20_58_21" id="tag_20_58_21"></a>CHANGE HISTORY</h4>
    221 <blockquote>
    222 <p>First released in Issue 3.</p>
    223 </blockquote>
    224 <h4 class="mansect"><a name="tag_20_58_22" id="tag_20_58_22"></a>Issue 6</h4>
    225 <blockquote>
    226 <p>This utility has been rewritten to align with the IEEE&nbsp;P1003.2b draft standard. Specifically, the ability to use charmap
    227 files for conversion has been added.</p>
    228 <p>IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;1-2002, item XCU/TC1/D6/29 is applied, making changes to address inconsistencies with
    229 the <a href="../functions/iconv.html"><i>iconv</i>()</a> function in the System Interfaces volume of POSIX.1-2024.</p>
    230 </blockquote>
    231 <h4 class="mansect"><a name="tag_20_58_23" id="tag_20_58_23"></a>Issue 7</h4>
    232 <blockquote>
    233 <p>Austin Group Interpretation 1003.1-2001 #206 is applied, correcting the <i>tomap</i> option.</p>
    234 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    235 <p>POSIX.1-2008, Technical Corrigendum 1, XCU/TC1-2008/0094 [291] and XCU/TC1-2008/0095 [291] are applied.</p>
    236 </blockquote>
    237 <h4 class="mansect"><a name="tag_20_58_24" id="tag_20_58_24"></a>Issue 8</h4>
    238 <blockquote>
    239 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    240 </blockquote>
    241 <div class="box"><em>End of informative text.</em></div>
    242 <hr>
    243 <p>&nbsp;</p>
    244 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    245 <hr size="2" noshade>
    246 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    247 POSIX™ is a Trademark of The IEEE.<br>
    248 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    249 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    250 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    251 ]</font></center>
    252 <hr size="2" noshade>
    253 <div class="NAVHEADER">
    254 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    255 <tr class="nav">
    256 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/head.html" accesskey="P">&lt;&lt;&lt;
    257 Previous</a></td>
    258 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    259 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/id.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
    260 </tr>
    261 </table>
    262 <hr align="left" width="100%"></div>
    263 </body>
    264 </html>