Translating files between different codesets
Use
iconv(1)
to translate files between different codesets.
For example:
iconv -f local8 -t ISO8859-1 < infile > outfile
This converts infile from the local8 codeset to
outfile in ISO8859-1 encoding.
The character encoding in either the -f (from) codeset or the
-t (to) codeset is in single-byte values (such as
ISO8859-1 or ASCII).
You might need to translate files between different codesets if:
-
the files were written under 7-bit software that does not
conform to the ISO8859-1 character set.
-
the files were generated by software using
IBM437 characters which you need to use with a program using
ISO8859-1 characters.
-
the files contain one character set and you need to use them
with a device (such as a printer) that uses a different character set.
Although iconv is the recommended translation filter, the older
trchan(1)
utility is still available.
trchan is a filter that acts in the same way as
mapchan(1M)
and uses the same mapping files. For example, to
translate a file from ISO8859-1 to US ASCII,
where US ASCII is the character set currently in use,
enter:
trchan -i /usr/lib/mapchan/ISO8859-1/iso < inputfile > outputfile
This command uses the input section of
/usr/lib/mapchan/ISO8859-1/iso to translate inputfile,
and writes the result to outputfile.
Next topic:
Changing the system time zone
Previous topic:
Setting the console codeset
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004