fkconv(3K) 2/4/92 fkconv(3K)
NAME
fkconv - kanji code converter
SYNOPSIS
cc [flag...] file... -lkanji [library...]
#include <mlx-j/kanji.h>
int fkconv(FILE *in, FILE *out, int ifmt, int ofmt, int ko, int exp);
DESCRIPTION
fkconv handles arbitrary conversions between EUC, Shift-JIS, JIS, Old
JIS and NEC-JIS encoded text. The routine supports all of the
characters defined in JIS X 0208-1990, as well as EUC codeset 3
(gaiji) characters.
in and out are the input and output stream for conversion,
respectively. in must be open for reading, out must be open for
writing.
The ifmt and ofmt arguments determine the input and output code and
may take the following values:
KJJIS - (New) JIS
KJOJIS - Old JIS
KJNECJIS - NEC-JIS
KJSJIS - Shift-JIS
KJEUC - Extended UNIX Code
If ofmt is KJJIS or KJOJIS, ko must be set to KJTOROMAN or
KJTOASCII. It determines the shift-out sequence to be placed in the
output (JIS-Roman or ASCII). ko is ignored for other values of ofmt.
The exp argument must be set to KJEXP or KJNOEXP. KJEXP indicates
that half-size katakana should be expanded to their full-size
equivalents, KJNOEXP causes half-size katakana to be preserved in
the output. The value of exp is ignored and expansion takes place
regardless if the output is in one of the 7-bit codes, since these
codes do not include half-size katakana.
RETURN VALUE
Successful conversion returns a value of 0, I/O errors on in or out
return -1. Otherwise, one of the (non-fatal) error codes below is
returned. Conversion does not stop when one of these errors is
detected.
KJERROR
An invalid byte or byte sequence was detected in the input.
Typically, this happens when a byte which introduces a kanji
character is not followed by a byte sequence to validly complete
it, or when a partial escape sequence or character is found
at EOF.
Page 1 Reliant UNIX 5.44 2, 194
fkconv(3K) 2/4/92 fkconv(3K)
KJGAIJI
EUC codeset 3 (gaiji) characters are not part of Shift-JIS or any
of the 7-bit codes. This means that gaiji characters are handled
correctly only when converting from EUC to EUC (to expand
half-size katakana). For other output codes, gaiji characters are
passed through (in shifted-out mode), and KJGAIJI is returned.
KJNEW
In 1983, four kanji were appended to JIS X 0208 level 2, followed
by another two kanji in 1990. These characters are not part of
Old JIS and NEC-JIS, and are passed through in shifted-out mode
for output codes of KJOJIS and KJNECJIS, with a return value
of KJNEW.
KJESC
When converting from EUC or Shift-JIS to one of the 7-bit codes,
it is possible that a shift-in or shift-out sequence is present
in the ASCII portion of the input. These escape sequences cannot
be passed through to the output since they would change the shift
state. Such escape sequences in the input are skipped and the
return value is set to KJESC.
NOTES
Invalid byte sequences in the input are copied through to the output
unchanged (in shifted-out mode).
in must initially be in shifted-out mode and must be aligned on a
character boundary.
BUGS
If more than one error condition is detected during conversion, the
return code always indicates the first problem that was found.
Invalid byte sequences in the input may cause fkconv to lose
synchronization with kanji character boundaries. If this happens, all
converted output following the error is likely to be garbage.
FILES
/usr/lib/libkanji.a
SEE ALSO
kconv(3K), skconv(3K), ckconv(3K), fkcode(3K), fkverify(3K),
fkeuctoibmj(3K), fkibmjtoeuc(3K).
Page 2 Reliant UNIX 5.44 2, 194