1 .TH PRECONV @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
3 preconv \- convert encoding of input files to something GNU troff understands
8 Copyright \[co] 2006-2014 Free Software Foundation, Inc.
10 Permission is granted to make and distribute verbatim copies of
11 this manual provided the copyright notice and this permission notice
12 are preserved on all copies.
14 Permission is granted to copy and distribute modified versions of this
15 manual under the conditions for verbatim copying, provided that the
16 entire resulting derived work is distributed under the terms of a
17 permission notice identical to this one.
19 Permission is granted to copy and distribute translations of this
20 manual into another language, under the above conditions for modified
21 versions, except that this permission notice may be included in
22 translations approved by the Free Software Foundation instead of in
26 .\" --------------------------------------------------------------------
28 .\" --------------------------------------------------------------------
49 It is possible to have whitespace between the
51 command line option and its parameter.
54 .\" --------------------------------------------------------------------
56 .\" --------------------------------------------------------------------
61 and converts its encoding(s) to a form GNU
63 can process, sending the data to standard output.
65 Currently, this means ASCII characters and \[oq]\e[uXXXX]\[cq]
66 entities, where \[oq]XXXX\[cq] is a hexadecimal number with four to
67 six digits, representing a Unicode input code.
71 should be invoked with the
79 .\" --------------------------------------------------------------------
81 .\" --------------------------------------------------------------------
85 Emit debugging messages to standard error (mainly the used encoding).
89 Specify default encoding if everything fails (see below).
93 Specify input encoding explicitly, overriding all other methods.
102 uses the algorithm described below to select the input encoding.
112 Do not add \&.lf requests.
118 Print version number.
121 .\" --------------------------------------------------------------------
123 .\" --------------------------------------------------------------------
126 tries to find the input encoding with the following algorithm.
129 If the input encoding has been explicitly specified with option
134 Otherwise, check whether the input starts with a
141 Finally, check whether there is a known
143 (see below) in either the first or second input line.
148 If everything fails, use a default encoding as given with option
150 by the current locale, or \[oq]latin1\[cq] if the locale is set to
151 \[oq]C\[cq], \[oq]POSIX\[cq], or empty (in that order).
159 environment variable which is eventually expanded to option
163 .\" --------------------------------------------------------------------
164 .SS "Byte Order Mark"
165 .\" --------------------------------------------------------------------
167 The Unicode Standard defines character U+FEFF as the Byte Order Mark
170 On the other hand, value U+FFFE is guaranteed not be a Unicode character at
173 This allows to detect the byte order within the data stream (either
174 big-endian or lower-endian), and the MIME encodings \%\[oq]UTF-16\[cq]
175 and \%\[oq]UTF-32\[cq] mandate that the data stream starts with U+FEFF.
177 Similarly, the data stream encoded as \%\[oq]UTF-8\[cq] might start
178 with a BOM (to ease the conversion from and to \%UTF-16 and \%UTF-32).
180 In all cases, the byte order mark is
182 part of the data but part of the encoding protocol; in other words,
184 output doesn\[aq]t contain it.
188 Note that U+FEFF not at the start of the input data actually is
189 emitted; it has then the meaning of a \[oq]zero width no-break
190 space\[cq] character \[en] something not needed normally in
194 .\" --------------------------------------------------------------------
196 .\" --------------------------------------------------------------------
198 Editors which support more than a single character encoding need tags
199 within the input files to mark the file\[aq]s encoding.
201 While it is possible to guess the right input encoding with the help of
202 heuristic algorithms for data which represents a greater amount of a natural
203 language, it is still just a guess.
205 Additionally, all algorithms fail easily for input which is either too short
206 or doesn\[aq]t represent a natural language.
212 supports the coding tag convention (with some restrictions) as used by
216 (and probably other programs too).
224 are stored in so-called
225 .IR "File Variables" .
228 recognizes the following syntax form which must be put into a troff comment
229 in the first or second line.
243 The only relevant tag for
245 is \[oq]coding\[cq] which can take the values listed below.
247 Here an example line which tells
249 to edit a file in troff mode, and to use \%latin2 as its encoding.
254 \&.\[rs]" \-*\- mode: troff; coding: latin-2 \-*\-\""
260 The following list gives all MIME coding tags (either lowercase or
261 uppercase) supported by
263 this list is hard-coded in the source.
268 \%big5, \%cp1047, \%euc-jp, \%euc-kr, \%gb2312, \%iso-8859-1,
269 \%iso-8859-2, \%iso-8859-5, \%iso-8859-7, \%iso-8859-9, \%iso-8859-13,
270 \%iso-8859-15, \%koi8-r, \%us-ascii, \%utf-8, \%utf-16, \%utf-16be,
277 In addition, the following hard-coded list of other tags is recognized
278 which eventually map to values from the list above.
283 \%ascii, \%chinese-big5, \%chinese-euc, \%chinese-iso-8bit, \%cn-big5,
284 \%\%cn-gb, \%cn-gb-2312, \%cp878, \%csascii, \%csisolatin1,
285 \%cyrillic-iso-8bit, \%cyrillic-koi8, \%euc-china, \%euc-cn,
286 \%euc-japan, \%euc-japan-1990, \%euc-korea, \%greek-iso-8bit,
287 \%iso-10646/utf8, \%iso-10646/utf-8, \%iso-latin-1, \%iso-latin-2,
288 \%iso-latin-5, \%iso-latin-7, \%iso-latin-9, \%japanese-euc,
289 \%japanese-iso-8bit, \%jis8, \%koi8, \%korean-euc, \%korean-iso-8bit,
290 \%latin-0, \%latin1, \%latin-1, \%latin-2, \%latin-5, \%latin-7,
291 \%latin-9, \%mule-utf-8, \%mule-utf-16, \%mule-utf-16be,
292 \%mule-utf-16-be, \%mule-utf-16be-with-signature, \%mule-utf-16le,
293 \%mule-utf-16-le, \%mule-utf-16le-with-signature, \%utf8, \%utf-16-be,
294 \%utf-16-be-with-signature, \%utf-16be-with-signature, \%utf-16-le,
295 \%utf-16-le-with-signature, \%utf-16le-with-signature
301 Those tags are taken from
305 together with some aliases.
307 Trailing \%\[oq]-dos\[cq], \%\[oq]-unix\[cq], and \%\[oq]-mac\[cq]
308 suffixes of coding tags (which give the end-of-line convention used in
309 the file) are stripped off before the comparison with the above tags
314 by itself only supports three encodings: \%latin-1, cp1047, and \%UTF-8;
315 all other encodings are passed to the
319 At compile time it is searched and checked for a valid
321 implementation; a call to \[oq]preconv \-\-version\[cq] shows whether
326 .\" --------------------------------------------------------------------
328 .\" --------------------------------------------------------------------
332 .I "local variable lists"
335 This is a different syntax form to specify local variables at the end of a
339 .\" --------------------------------------------------------------------
341 .\" --------------------------------------------------------------------
343 .BR groff (@MAN1EXT@)
352 .\" --------------------------------------------------------------------
354 .\" --------------------------------------------------------------------