4 Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
6 Copyright (C) 2006 - 2008 Free Software Foundation, Inc.
8 Permission is granted to make and distribute verbatim copies of
9 this manual provided the copyright notice and this permission notice
10 are preserved on all copies.
12 Permission is granted to copy and distribute modified versions of this
13 manual under the conditions for verbatim copying, provided that the
14 entire resulting derived work is distributed under the terms of a
15 permission notice identical to this one.
17 Permission is granted to copy and distribute translations of this
18 manual into another language, under the above conditions for modified
19 versions, except that this permission notice may be included in
20 translations approved by the Free Software Foundation instead of in
24 .do nr __compat \n[.C]
28 .TH @U_P_PRECONV@ @MAN1EXT@ "@MDATE@" "@T_ROFF@ v@VERSION@"
32 @L_P_PRECONV@ \- convert encoding of input files
54 It is possible to have whitespace between the
56 command line option and its parameter.
63 and converts its encoding(s) to a form
64 .BR @L_TROFF@ (@MAN1EXT@)
65 can process, sending the data to standard output.
66 Currently, this means ASCII characters and `\e[uXXXX]' entities, where
67 `XXXX' is a hexadecimal number with four to six digits, representing a
71 should be invoked with the
82 Emit debugging messages to standard error (mainly the used encoding).
86 Specify default encoding if everything fails (see below).
90 Specify input encoding explicitly, overriding all other methods.
97 uses the algorithm described below to select the input encoding.
107 Do not add .lf requests.
113 Print version number.
118 tries to find the input encoding with the following algorithm.
121 If the input encoding has been explicitly specified with option
126 Otherwise, check whether the input starts with a
132 Finally, check whether there is a known
134 (see below) in either the first or second input line.
138 If everything fails, use a default encoding as given with option
140 by the current locale, or `latin1' if the locale is set to `C',
141 `POSIX', or empty (in that order).
148 environment variable which is eventually expanded to option
151 .SS "Byte Order Mark"
152 The Unicode Standard defines character U+FEFF as the Byte Order Mark
154 On the other hand, value U+FFFE is guaranteed not be a Unicode character at
156 This allows to detect the byte order within the data stream (either
157 big-endian or lower-endian), and the MIME encodings \%`UTF-16' and
158 \%`UTF-32' mandate that the data stream starts with U+FEFF.
159 Similarly, the data stream encoded as \%`UTF-8' might start with a BOM (to
160 ease the conversion from and to \%UTF-16 and \%UTF-32).
161 In all cases, the byte order mark is
163 part of the data but part of the encoding protocol; in other words,
165 output doesn't contain it.
168 Note that U+FEFF not at the start of the input data actually is emitted;
169 it has then the meaning of a `zero width no-break space' character \[en]
170 something not needed normally in
174 Editors which support more than a single character encoding need tags
175 within the input files to mark the file's encoding.
176 While it is possible to guess the right input encoding with the help of
177 heuristic algorithms for data which represents a greater amount of a natural
178 language, it is still just a guess.
179 Additionally, all algorithms fail easily for input which is either too short
180 or doesn't represent a natural language.
185 supports the coding tag convention (with some restrictions) as used by
189 (and probably other programs too).
196 are stored in so-called
197 .IR "File Variables" .
199 recognizes the following syntax form which must be put into a troff comment
200 in the first or second line.
213 The only relevant tag for
215 is `coding' which can take the values listed below.
216 Here an example line which tells
218 to edit a file in troff mode, and to use \%latin2 as its encoding.
223 \&.\[rs]" \-*\- mode: troff; coding: latin-2 \-*\-
228 The following list gives all MIME coding tags (either lowercase or
229 uppercase) supported by
231 this list is hard-coded in the source.
236 \%big5, \%cp1047, \%euc-jp, \%euc-kr, \%gb2312, \%iso-8859-1, \%iso-8859-2,
237 \%iso-8859-5, \%iso-8859-7, \%iso-8859-9, \%iso-8859-13, \%iso-8859-15,
238 \%koi8-r, \%us-ascii, \%utf-8, \%utf-16, \%utf-16be, \%utf-16le
243 In addition, the following hard-coded list of other tags is recognized which
244 eventually map to values from the list above.
249 \%ascii, \%chinese-big5, \%chinese-euc, \%chinese-iso-8bit, \%cn-big5,
250 \%\%cn-gb, \%cn-gb-2312, \%cp878, \%csascii, \%csisolatin1,
251 \%cyrillic-iso-8bit, \%cyrillic-koi8, \%euc-china, \%euc-cn, \%euc-japan,
252 \%euc-japan-1990, \%euc-korea, \%greek-iso-8bit, \%iso-10646/utf8,
253 \%iso-10646/utf-8, \%iso-latin-1, \%iso-latin-2, \%iso-latin-5,
254 \%iso-latin-7, \%iso-latin-9, \%japanese-euc, \%japanese-iso-8bit, \%jis8,
255 \%koi8, \%korean-euc, \%korean-iso-8bit, \%latin-0, \%latin1, \%latin-1,
256 \%latin-2, \%latin-5, \%latin-7, \%latin-9, \%mule-utf-8, \%mule-utf-16,
257 \%mule-utf-16be, \%mule-utf-16-be, \%mule-utf-16be-with-signature,
258 \%mule-utf-16le, \%mule-utf-16-le, \%mule-utf-16le-with-signature, \%utf8,
259 \%utf-16-be, \%utf-16-be-with-signature, \%utf-16be-with-signature,
260 \%utf-16-le, \%utf-16-le-with-signature, \%utf-16le-with-signature
265 Those tags are taken from
269 together with some aliases.
270 Trailing \%`-dos', \%`-unix', and \%`-mac' suffixes of coding tags (which
271 give the end-of-line convention used in the file) are stripped off before
272 the comparison with the above tags happens.
276 by itself only supports three encodings: \%latin-1, cp1047, and \%UTF-8;
277 all other encodings are passed to the
280 At compile time it is searched and checked for a valid
282 implementation; a call to `@L_P_PRECONV@ \-\-version' shows whether
290 .I "local variable lists"
292 This is a different syntax form to specify local variables at the end of a
297 .BR @L_ROFF@ (@MAN1EXT@)