codeset_conv(5) DG/UX 5.4 Rel. 2.01 codeset_conv(5)
NAME
codesetconv - localization support for code set conversions
DESCRIPTION
In DG/UX there are two facilities for performing code set
conversions, the STREAMS based method, attkbd(7); and the file based
method, iconv(1). The attkbd(7) facility can perform two types of
operations on an input stream: the first type is simple byte-swapping
via a code set conversion (lookup) table, the second is string
translation. In the case of the iconv(1) facility, it uses the
database file, /usr/lib/kbd/iconvdata, to convert the encoding of
characters in a file from one code set to another and write the
results to standard output.
STREAMS Based Method
In the attkbd(7) STREAMS module, code set conversion occurs as
characters pass through a byte stream. This feature supports
connecting terminals and printers to a system which have incompatible
code sets. Once the attkbd(7) STREAMS module is pushed onto a tty
stream, a code set conversion table can be attached to either the
input or output side of the stream, or both. See iconv(1) for a
listing of code set conversions supported in DG/UX.
Using code set conversion with the attkbd(7) STREAMS module involves
the following steps illustrated by the example script below. Use
strconf(1) to display the modules on the current STREAM and to
determine number of pops and pushs to get the att_kbd module
positioned directly beneath the ldterm module. Save the current stty
settings in a form that can be used to restore them after the att_kbd
STREAMS module is in place and the other STREAMS modules have been
replaced. Position the att_kbd module directly beneath the ldterm
module using strchg(1) to push or pop STREAMS modules on or off the
current STREAM. Restore original stty settings from those saved
earlier. Load code set conversion tables from kbdmap files in
/usr/lib/kbd directory using kbdload(1M). These tables are loaded
(copied from disk into main memory) into the attkbd STREAMS module,
which has been pushed onto the current STREAM. Finally, use
kbdset(1) to attach the conversion tables to the input or output side
of the attkbd(7) module, as well as to display the status of loaded
tables.
To build a customized attkbd(7) conversion table, use kbdcomp(1M) to
compile the table from source into object-code.
File Based Method
In the file based method, encoding characters in a file are converted
from one code set to another using the iconv(1) utility. If your
printer supports a different code set than the one used in the file
you wish to print, iconv(1) can be used in a pipeline to convert data
in the file to the code set supported by your printer. See the
second example below.
EXAMPLES
Sample script for setting up attkbd(7) STREAMS based conversion
Licensed material--property of copyright holder(s) 1
codeset_conv(5) DG/UX 5.4 Rel. 2.01 codeset_conv(5)
between 8859-1 and dgi code sets.
#
# Run "strconf" to determine number of pops and pushs to get attkbd
# positioned directly beneath ldterm.
#
# This script was written for the following output from "strconf":
#
# $ strconf
# ttcompat
# ldterm
# ptem
# pts
#
# Based on "strconf" output we must:
#
# Save current stty settings in a form that can be used to restore
# them after the attkbd STREAMS module is in place and the other
# STREAMS modules have been replaced.
STTY=`stty -g`
# pop ttcompat STREAMS module
strchg -p
# pop ldterm STREAMS module
strchg -p
# push attkbd STREAMS module
strchg -h attkbd
# push ldterm STREAMS module
strchg -h ldterm
# push ttcompat STREAMS module
strchg -h ttcompat
# Restore original stty settings from those saved in $STTY earlier
stty $STTY
# Load tables for dgi <---> 88591 from kbdmap files
# Tables included in 88591.dgi.d and dgi.88591.d are loaded (copied from
# disk into main memory) into the attkbd STREAMS module, which must
# already have been pushed into the standard input STREAM.
kbdload /usr/lib/kbd/88591.dgi.d
kbdload /usr/lib/kbd/dgi.88591.d
# On the input side of the STREAM,
# attach to the table for dgi --> 88591
kbdset -a dgi.88591.d
# On the output side of the STREAM,
# attach to the table for 88591 --> dgi
kbdset -oa 88591.dgi.d
Licensed material--property of copyright holder(s) 2
codeset_conv(5) DG/UX 5.4 Rel. 2.01 codeset_conv(5)
The following will print foobar, whose character data is in the PC
437 code set, on a printer that uses the ISO 8859-1 code set:
pr foobar | iconv -fPC437 -t88591 -mp | lp
FILES
/usr/lib/kbd directory containing system standard map
files
/usr/lib/kbd/*.map source for some system map files
/usr/lib/kbd/iconvdata default database
SEE ALSO
attkbd(7), iconv(1).
Licensed material--property of copyright holder(s) 3