[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hebrew support for MDA CGA Hercules - HEBREW-2-HOWTO
HEBREW-2-HOWTO
VERSION: 0.0a
DATE: 07 FEB 1998
AUTHOR: Peter Lorand Peres (plp@actcom.co.il)
This is the HEBREW-2-HOWTO, an addition to the HEBREW-HOWTO. It describes
certain character mapping issues that relate to the use of Hebrew on
character-mode machines with MDA, CGA or Hercules video adapters, which do
not have the capability to load custom fonts.
Introduction
------------
In countries such as Israel, the local language character set is
disjoint from the usual English character set. Older type video cards are
manufactured with certain fonts built-in. All video cards newer than the
CGA/MDA/Hercules adapters, have the capability to load a custom font for
character mode. CGA/MDA and Hercules adapters cannot do that. Their
character set is fixed by the factory. Such cards imported into Israel
have an exchanged EPROM on them, which contains the Hebrew character
set(s). They are often used on Linux servers, firewalls and routers
because it makes no sense to use a color monitor and a VGA card for setup
only. There is typically no Hebrew support for these for now, from stock
Linux distributions.
By default, Linux distributions cannot handle this type of card for
Hebrew. Although all Linuxes recognize and work well with such cards, the
default setup options for character fonts will cause an error to occur when
they are used on such cards.
The ISO code for Israel is ISO 8859-8. Unfortunately there are several
ways to encode Hebrew. Usually on the Internet, the ISO encoding is used,
with Hebrew Aleph encoded as decimal 224. This is different than the usual
PC Hebrew used under DOS, which uses code 128 for Aleph. Unicode support
starts being built into Linux, but CGA and MDA cards cannot cope with the
Unicode mappings (some modern VT terminals can, however).
The method described in the HEBREW-HOWTO does NOT work. It relies on
the same method of changing the font, as every other language support.
The Problem
-----------
Custom character map installation on Linux virtual terminals relies on the
loading of an appropriate font into the character table of the video
adapter. The command used to do this is setfont(8) which can only be used by
root, as it sets the default font for all of the virtual consoles.
This command is installed by the default setup scripts of many
distributions, if the 'try optional console fonts' option is answered with
'yes' in the default setup program.
If this command is used, then the ioctl system call that does the actual
font loading will fail, since the particular driver used in the kernel for
MDA/CGA consoles does not accept it. If the command is made a part of the
setup script of a Linux machine, it will break its boot process every time
at this point.
The Solution
------------
The MDA/CGA adapter already has the Hebrew font built into its EPROM. No
font needs to be loaded for it. Only the console font mapping needs to be
changed. The command to do this is: mapscrn
mapscrn takes a filename as an argument. It must contain the character
mapping for the desired font set. Refer to the manual page for mapscrn for
more information, and to the files in the directory
/usr/lib/kbd/consoletrans. Ignore the files with the *.uni suffix, they
refer to UNICODE mappings which cannot be used directly here (there are no
UNICODE-compatible CGA cards as far as I know ;).
For CGA terminals, the ISO Hebrew encoding used on the Internet must be
converted to PC Hebrew. This means, that the codes in the range 224-250
must be mapped to the codes in the range 128-154. Codes in the range
128-154 remain identity-mapped. This allows the use of Hebrew texts
elaborated under DOS with such a terminal (although they should be
translated to ISO Hebrew using the command 'tr' before attempting any
editing).
The command would be:
# mapscrn /usr/lib/kbd/consoletrans/cga-hebrew ; echo -e "\033(K"
This sets the mapping on a virtual terminals. The line above must
be added to the boot scripts of the machine, before it hoes multi-user.
The mapping cannot be undone and the <ESC>(K sequences do not work as
expected, the installed mapping remains active after this.
This mapping leaves the English default mapping as is. The command
'reset' will reset the terminal where it was issued to identity mapping.
The terminal will remain in this (reset) state after a logout. If it is
important to conserve the Hebrew mapping over a logout, the line described
above must be added to the startup scripts of each user, or to the shell
profile. To disallow users from remapping their terminal console, move the
mapscrn command into /usr/sbin or change its permissions. This may not be
enough for users who can mount floppies or use a compiler (or even ftp for
that matter).
Notice that if someone (root or an user) uses mapscrn and issues the
ESC(K only to a part of the terminals, the others will remain mapped with
the previous mapping. This could be useful for something (but I don't know
for what).
I think that in the case of a public access system, it would be wise to
set up a guest account such that it logs out atomatically after a set time
of inactivity, and add the described remapping, together with a keyboard
remapping to its setup scripts, making sure that they are executed with
each login (and perhaps also after each login, if /etc/issue is to contain
any Hebrew).
Notice that any user running mapscrn followed by the ESC(K sequence will
map his terminal with the new map. Other consoles (including root's - if
open and locked or such) will not be remapped, until they will issue an
ESC(K. mapscrn usage by users should be disabled for all the virtual
terminals, as the current situation allows a remote user to run mapscrn
and send a message containing ESC(K to root, thus rendering his terminal
unusable until he runs the reset command.
I supply a suitable keymap generator here (which I have called
cga-hebrew) in the form of a shell script. Save this script, and run it
using a command like:
# sh mkcgahebrew.sh >/usr/lib/kbd/consoletrans/cga-hebrew
as root, and then change the permissions of the file to root.root 444.
Here is the script:
-- snip --
#!/bin/bash
#
# /usr/lib/kbd/consoletrans/mkcga-hebrew.sh root.root 500
#
# Make a console mapping for MDA/CGA graphics cards with Hebrew in EPROM.
# This script can be modified to build tables for other national languages
# that have fonts 'hard-coded' in an EPROM, and are mapped differently than
# the default ISO map.
#
# USAGE: mkhebmap.sh >this.map
#
# Written by plp (Peter Lorand Peres - plp@actcom.co.il)
# FEB 98
LANG="CGA-Hebrew"
in=32
out=0
OFFSET=$[ 224 - 128 ]
echo -e "# mkhebmap.sh: $LANG $(date)"
while [ $in -le 255 ]; do
if [ $in -ge 224 -a $in -le 250 ]; then
if [ $in -eq 224 ]; then
echo "# ISO $LANG starts here"
fi
echo -e "$in\t$[ $in - $OFFSET ]"
else
echo -e "$in\t$in"
fi
in=$[ $in + 1 ]
done
exit 0
-- snap --
To make this work with the setup described in the HEBREW-HOWTO, make the
following changes to the description in the HEBREW-HOWTO, under 'VC
setup':
from:
setfont iso08.f16
mapscrn trivial
loadkeys Hebrew
to:
#setfont iso08.f16
mapscrn cga-hebrew
loadkeys Hebrew
That's it. I remind that there is a version of hebrew-enabled pine, with
its pico editor, available among other places from academic FTP sites in
Israel. The text-mode browser, Lynx, can be used to browse most Israeli
sites using this setup. There is no need to use a keyboard mapping, and
don't forget that you will need to set up Hebrew Pico to be able to send
Hebrew email responses to mailto: URLs.
I will add a section describing a printcap entry for 'old' dot matrix
printers that does the same kind of mapping real soon now [tm]. This
should give rugged line printers used in businesses a new lease on life.
If you prefer to write your own, take a look at the 'tr' command, and at
the description of the 'of' filter in termcap.
Known Bugs
----------
There is a security issue with allowing any user to change keyboard and
console mappings on a publically available machine. There may also be some
other problems I am not aware of.
The version of Lynx that is supplied with Linux causes Hebrew text from
websites to be displayed correctly with this method, but some buttons will
appear with text spelled backwards, if they have Hebrew text specified for
the button (such as 'submit' buttons on some search pages). I don't know
whose end is broken ;)
The method described here can be used ONLY for MDA, CGA and Hercules
adapters that have a Hebrew character set installed. It will not work for
cards that do not have an EPROM with Hebrew fonts in it. You can tell if a
card has been modified, from the label on the EPROM, and from the fact
that it has got an erase window (factory ROM models have no window, and
sometimes are not even socketed).
I do not claim that this works at all, and if you break something with
it, you get to hold both ends. I'm saying this for the obvious reason.
If you decide that I can help you somehow, send me an email to
plp@actcom.co.il
This document will probably be made a part of the HOWTO collection soon,
and it might help others implement local language support in various
places where other EPROM-ed character sets are used.
Copyright
---------
Get this and do what you want with it, while leaving my name on it.
*** THE END ***