MirBSD manpage: iconv(1)

ICONV(1)                     BSD Reference Manual                     ICONV(1)


     iconv - convert between different codesets


     iconv [-cs] [-f fromcs] [-t tocs] [file ...]
     iconv -l


     The iconv utility converts the files (or standard input, if none given)
     from the encoding specified by fromcs, or the current locale's character
     set as specified by nl_langinfo(CODESET), to the encoding specified by
     tocs. If file is a single dash ('-') or absent, iconv reads from the
     standard input. The result is written to standard output, diagnostics and
     error messages are written to standard error.

     The options are as follows:

     -c         Omit any characters that are invalid in the codeset of the in-
                put file from the output. Normally, byte sequences that are no
                characters in the input codeset cause iconv to abort with a
                diagnostic message. If -c is given, they are still diagnosed
                (unless -s is given as well) but skipped (byte-wise) on read.

     -f fromcs  Identify the codeset of the input file. Processing of IEEE Std
                1003.1-2001 ("POSIX.1") Character Set Description Files is not
                implemented. If this option is not given, the codeset of the
                current locale is used.

     -l         Instead of codeset conversion, write a list of supported
                codesets, separated by newline, to standard output, then exit

     -s         Suppress any diagnostics written to standard error concerning
                invalid characters (both in the input codeset and in the out-
                put codeset, i.e. conversion information losses). Normally,
                invalid input characters, files that end with an incomplete or
                invalid character or shift sequence, and inconvertible charac-
                ters are reported, the latter once per file and in a final

     -t tocs    Identify the codeset of the output file. See -f for semantics.


     iconv -f latin1 -t utf-8 file.txt >newfile.txt


     Exit status is 0 on success, 1 on general failure, 2 if there is no known
     way to convert between the codesets given, and 3 if the output buffer is
     too small (implementation error, contact the developer in that case).


     iconv(3), nl_langinfo(3), setlocale(3)


     The iconv utility is expected to conform to Version 3 of the Single UNIX
     Specification ("SUSv3"). XSI is not supported. POSIX2_LOCALEDEF is not
     supported. If neither -f nor -t are given, or their arguments are the
     same or equivalent, input is passed through; invalid characters are not
     detected. Implementation-specific behaviour is as described in this manu-


     iconv appeared in MirBSD #10.


     The iconv utility and this manual page were written by Thorsten Glaser
     <tg@mirbsd.de>. MirBSD uses codeset conversion routines from the Citrus


     In the current implementation, if the output of a buffer is more than 16
     times the input buffer size, currently 64 KiB, an error is returned.

     The GNU extension of //TRANSLIT is not supported by Citrus iconv.

     Each input file is handled as a separate conversion unit, and the shift
     state is returned to inital after processing a file.

MirBSD #10-current             November 1, 2006                              1

Generated on 2021-12-07 11:07:08 by $MirOS: src/scripts/roff2htm,v 1.103 2021/01/23 20:24:35 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2021 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.