iconv - codeset conversion
iconv -f fromcode -t tocode [file...]
The iconv utility converts the encoding of characters in file from one codeset to another and writes the results to standard output.Character encodings in either codeset may include single-byte values (for example, for the ISO 8859-1:1987 standard characters) or multi-byte values (for example, for certain characters in the ISO 6937:1983 standard). The results of specifying invalid characters in the input stream (either those that are not valid members of the fromcode or those that have no corresponding value in tocode) are specified in the system documentation.
The iconv utility supports the XBD specification, Utility Syntax Guidelines . The following options are supported:
- -f fromcode
Identify the codeset of the input file. Valid values for fromcode are specified in the system documentation.
- -t tocode
Identify the codeset to be used for the output file. Valid values for tocode are specified in the system documentation.
The following operands are supported:
- file
- A pathname of the input file to be translated. If file is omitted, the standard input is used.
The standard input is used only if the file operand is omitted.
The input file is a text file.
The following environment variables affect the execution of iconv:
- LANG
- Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
- LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
- LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments). During translation of the file, this variable is superseded by the use of the fromcode option-argument.
- LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
- NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .
Default.
The standard output is a text file containing the translated data.
Used only for diagnostic messages.
None.
None.
The following exit values are returned:
- 0
- Successful completion.
- >0
- An error occurred.
Default.
None.
The following example converts the contents of file
mail.x400
from the ISO 6937:1983 standard codeset to the ISO 8859-1:1987 standard codeset,
and stores the results in file
mail.local:
iconv -f IS6937 -t IS8859 mail.x400 > mail.local
None.
gencat.