PRECONV(1) | General Commands Manual | PRECONV(1) |
NAME
preconv - convert encoding of input files to something GNU troff understandsSYNOPSIS
[-dr] [-e encoding] [files ...] -h | --help -v | --versionDESCRIPTION
preconv reads files and converts its encoding(s) to a form GNU troff(1) can process, sending the data to standard output. Currently, this means ASCII characters and `\[uXXXX]' entities, where `XXXX' is a hexadecimal number with four to six digits, representing a Unicode input code. Normally, preconv should be invoked with the -k and -K options of groff.OPTIONS
- -d
- Emit debugging messages to standard error (mainly the used encoding).
- -Dencoding
- Specify default encoding if everything fails (see below).
- -eencoding
- Specify input encoding explicitly, overriding all other methods. This corresponds to groff's -Kencoding option. Without this switch, preconv uses the algorithm described below to select the input encoding.
- --help
- -h Print help message.
- -r
- Do not add .lf requests.
- --version
- -v Print version number.
USAGE
preconv tries to find the input encoding with the following algorithm.- 1.
- If the input encoding has been explicitly specified with option -e, use it.
- 2.
- Otherwise, check whether the input starts with a Byte Order Mark (BOM, see below). If found, use it.
- 3.
- Finally, check whether there is a known coding tag (see below) in either the first or second input line. If found, use it.
- 4.
- If everything fails, use a default encoding as given with option -D, by the current locale, or `latin1' if the locale is set to `C', `POSIX', or empty (in that order).
Byte Order Mark
The Unicode Standard defines character U+FEFF as the Byte Order Mark (BOM). On the other hand, value U+FFFE is guaranteed not be a Unicode character at all. This allows to detect the byte order within the data stream (either big-endian or lower-endian), and the MIME encodings `UTF-16' and `UTF-32' mandate that the data stream starts with U+FEFF. Similarly, the data stream encoded as `UTF-8' might start with a BOM (to ease the conversion from and to UTF-16 and UTF-32). In all cases, the byte order mark is not part of the data but part of the encoding protocol; in other words, preconv's output doesn't contain it.Coding Tags
Editors which support more than a single character encoding need tags within the input files to mark the file's encoding. While it is possible to guess the right input encoding with the help of heuristic algorithms for data which represents a greater amount of a natural language, it is still just a guess. Additionally, all algorithms fail easily for input which is either too short or doesn't represent a natural language..\" -*- mode: troff; coding: latin-2 -*-
Iconv Issues
preconv by itself only supports three encodings: latin-1, cp1047, and UTF-8; all other encodings are passed to the iconv library functions. At compile time it is searched and checked for a valid iconv implementation; a call to `preconv --version' shows whether iconv is used.BUGS
preconv doesn't support local variable lists yet. This is a different syntax form to specify local variables at the end of a file.SEE ALSO
groff(1)30 December 2012 | Groff Version 1.22.1 |