DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Specifying the locale

Creating a character mapping table

It might be necessary to modify the provided mapchan(F) files to support new hardware or software which requires character sets other than ISO8859-1. mapchan(M) works on characters coming from or going to a device, translating them to and from the internal system codeset.

The mapchan files are stored in subdirectories in /usr/lib/mapchan. The subdirectories are named for the supported SCO OpenServer internal system codesets. (The files in /usr/lib/mapchan/ISO8859-1 are duplicated in /usr/lib/mapchan itself for backward compatibility.) The default mapchan file for each device on the system is listed in /etc/default/mapchan. To create a new character mapping table, copy an existing mapchan file and modify it, then reinstall it in the appropriate subdirectory in /usr/lib/mapchan.

mapchan files contain several divisions, each of which controls some aspect of the mapping between the internal character set used by the system and the character set used by the terminal or device. You might want to change one or more of these divisions.

For details, see:

Mapping input characters

Use mapchan(M) to filter characters from peripheral devices to and from an internal codeset that is used by software running on the system. See ``Device mapping'' for more information.

To switch off mapchan filtering, enter:

mapchan -n

To switch it on, enter:

mapchan -f mapfile

Here, mapfile is the path and filename of the mapping file you want to use.

Alternatively, create a shell script for each program to switch mapchan off, run the program, and then reset mapchan on exiting from the program.

If you have a number of users who have different mapchan configurations, you must create individual scripts for each of them. A typical script for a program called seven, which saves and then restores the current mapping, is:

   tmpfile=/tmp/map$$
   trap "rm $tmpfile" 0 1 2 3 15
   mapchan > $tmpfile
   mapchan -n
   seven
   mapchan -f $tmpfile

Getting input from mapchan

The input section of a mapchan(F) file determines how input codesets are translated into the internal system codeset. The left column contains the input character code generated by the keyboard. When this character is input, the corresponding character in the right column is returned by mapchan(M) (it is sent as input to the running program on the terminal, or used for storing data in the filesystem).

If you have the ISO8859-1 set as the internal character set, you need to map the 8-bit characters (characters with values greater than 127 decimal).

If you are using the IBM437 codeset internally you need to map only the ``§'' symbol. This symbol is normally mapped into the 0xb2 instead, because it has the same code as <Ctrl>u, which the system treats as a command to clear the line. Configure mapchan to translate this symbol back to the 8-bit PC code.

Mapping output escape sequences

The output section of the mapchan(F) file controls the way in which characters are mapped from the internal character set to the character set configured for the device in use. For example, the default console display configuration understands 8-bit IBM437 characters. The paragraph, section, and cent symbols use codes which have a special meaning to the UNIX console driver. To make them print, you must translate them to graphic escape sequences.

The output section is:

   output
   20      0x1b '[' '2' '0' 'g'        # paragraph sign
   21      0x1b '[' '2' '1' 'g'        # section sign
   155     0x1b '[' '1' '5' '5' 'g'    # cent sign
If you are simply mapping from an ISO8859-1 character set to the IBM437 set, typical characters are:
   output
   0xc0    'A'     # use A since no A grave available
   0xc4    0x8e    # A umlaut
The mapchan files have been written so that the closest printable character is used if a character is not available.

Mapping dead key sequences

The dead key section of the mapchan(F) file maps the characters for each dead key on a serial terminal. (A dead key is a key that generates no output when pressed, but that displays a character when a subsequent key is pressed: for example, pressing the ```'' followed by an ``a'' prints a ``à''.) Dead keys are similar to compose sequences but are used for entering accented characters. Compose sequences are more commonly used for entering non-standard characters.

Typical mappings for a dead key for caret characters using ISO8859-1 are:

   dead	0xb0    # declare the caret character
    'a'	0xe2    # character for a with caret
    'e'	0xea    # character for e with caret
For details on the dead key section and a table of available dead key sequences, see the mapchan(F) manual page.

Mapping compose sequences

Compose sequences allow you to press a number of keys to compose a particular character. The sequence starts when the compose key is typed and is completed by two further keys that specify the character input. For example, the supplied map files allow you to generate the registered trademark symbol ``®'' by pressing:

<compose key> r o

Compose sequences are not the same as dead keys; a dead key produces no output when you press it, but applies an accent to the next character you enter. See ``Mapping dead key sequences''.

Compose sequences (and dead keys) are configured on terminals or the console using mapchan(M).

The supplied mapping files all use <Ctrl>_ (``control underscore'') as the character to introduce a compose sequence. The PC console might also use the <Alt><SysReq> key to introduce a compose sequence. On keyboards with 12 function keys, the alternative compose key is the ``*'' symbol on the numeric keypad.

The compose key section in the mapchan configuration file (like the dead key section) declares the compose key, followed by a list of the characters to be mapped. In all cases, two characters follow the compose key. For example, mapping compose keys within the 7-bit range of characters common to the ASCII, ISO8859-1, and IBM437 character sets:

   compose   	0x1f    # compose key is ^_
   __   		0x1f    # output the compose key value
   ++   		'#'     # two + characters generate a #
For more information on compose key mapping and a table of available compose key sequences, see the mapchan(F) manual page.

Mapping function keys

Function keys usually generate a control sequence of an escape character followed by one other character. If one of these characters is changed by mapkey, problems might result. For example, if a function key outputs ``^A 1'', programs that recognize that function key will not work correctly if the ``1'' is changed.

The control section of the mapchan file enables a specific number of characters to be ignored by mapchan when encountered as part of a terminal escape sequence or function keystroke. The following control section shows some typical sequences:

   CONTROL
   input
   ^A	1       # Function keys: ^A followed by one character
   \E	1       # Function keys: Escape followed by one character
   

output \Ea 4 # cursor control: Escape a and 4 other characters \EG 1 # set attributes: Escape G and one character

For full details of the control section of the mapchan file, see mapchan(F).
Next topic: Configuring SCOterm for European languages
Previous topic: Device mapping

© 2007 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 05 June 2007