kcode(1) 3/11/92 kcode(1)
NAME
kcode - kanji code detector
SYNOPSIS
kcode [-q] [-v] [-l limit] [file...]
DESCRIPTION
kcode examines the named files (stdin if none) and reports their kanji
encoding. The command recognizes EUC, Shift-JIS, JIS, Old JIS and
NEC-JIS encoded text.
If no input files or a single input file are specified, kcode prints
one of the following format identifiers on stdout:
jis - (New) JIS
ojis - Old JIS
njis - NEC-JIS
sjis - Shift-JIS
euc - Extended UNIX Code
ascii - only 7-bit ASCII characters present
unknown - unknown encoding
In addition, the message "ambiguous input format: EUC or Shift-JIS"
indicates that the input file contents may be either EUC or Shift-JIS,
and could not be distinguished further. This most commonly happens if
an input file contains only half-size katakana.
If two or more input files are specified, kcode prints the encoding of
each input file on a separate line, preceded by the file name and a
colon.
OPTIONS
-l limit
Limit the amount of text read from each input file to at most
limit bytes. This is useful if a file is very large, and it is
not known in advance whether the file contains any kanji
characters. This option may not be used in conjunction with the
-v option.
-q Report the input encoding via the exit status, instead of writing
a message to stdout. Exit status and encoding relate as follows:
0 - (New) JIS
1 - Old JIS
2 - NEC-JIS
3 - Shift-JIS
4 - Extended UNIX Code
90 - ambiguous input format: EUC or Shift-JIS
91 - input only contains 7-bit ASCII characters
92 - unknown encoding
This option may be used only if no input file or a single input
Page 1 Reliant UNIX 5.44 3, 1911
kcode(1) 3/11/92 kcode(1)
file is specified.
-v Normally, kcode only examines the input until it finds the first
byte sequence which uniquely identifies an encoding. If a valid
encoding was found, and the -v option is set, kcode verifies that
the remaining input conforms to the found encoding. Invalid byte
sequences in the input cause the encoding to be reported as
unknown. 7-bit encoded input files must terminate in shifted-out
mode to pass verification.
-v cannot be used in conjunction with the -l limit option.
DIAGNOSTICS
Normally, kcode returns an exit status of 0 (unless the -q option is
set). If an error occurs, a diagnostic is printed on stderr and the
exit status is set to 99.
SEE ALSO
kconv(1), kverify(1), fkcode(3K).
Page 2 Reliant UNIX 5.44 3, 1911