[Front] [Prev Chapter] [Next Chapter]

Chapter 17 Setting Up Code Page Switching

What is Code Page Switching?

Setting Up for Code Page Switching

Example Configuration Files

Working with Code Pages


The operating system allows you to use the range of characters required in a number of national languages by interpreting the different language-specific characters using a mechanism called code page switching.

Usually you only need to set your computer up for code page switching if you

If you are not in any of these situations, you probably do not need to use code page switching, or to read the information in this chapter.

What is Code Page Switching?

When you press a key on a keyboard (a letter, symbol, or number), the computer receives a numeric code that represents the way in which that keystroke is to be displayed, printed, and stored.

Up to 256 codes are available to represent lower and upper case letters, numbers, punctuation marks, and all the mathematical symbols on your keyboard. This may seem to be more than enough, but it is not possible to represent all the letters and characters used in every language in one character set of 256 codes. For example:

Character Sets

To accommodate these differences, a number of character sets are available. The numeric code entered when you press a key represents a different character depending on which character set is in use.

The most common character set (known as 437) is used for several languages including English, German, and French. Character sets 865 and 860 contain the characters needed for Danish and Portuguese respectively. In these character sets, some symbols available in 437 have been removed to make room for the extra letters needed. For example, the code for (franc) has been used for Ó in 860.

Definition of a Code Page

The character sets are stored in a table called a code page. The operating system allows you to change the code page that your computer uses, allowing you to view in its original form a document created using a different code page. Appendix D, "Code Pages" lists the characters available from different code pages.

Hardware Code Page

The hardware code page is the standard code page built into your computer. Additional code pages are provided in the Code Page Information or .CPI files in your software. Table 17-1 shows the national prepared code pages supported by the operating system. There is also an international code page, Code Page 850, that can be used in any of the countries (see Table 17-1).
Table 17-1
National Prepared Code Pages

Country

Code Pages Used

Australia

437

850

Austria

437

850

Belgium

437

850

Canada (English)

437

850

Canada (French)

863

850

Denmark

865

850

Finland

437

850

France

437

850

Germany

437

850

Hungary

852

850

Italy

437

850

Latin America

437

850

Netherlands

437

850

Norway

865

850

Portugal

860

850

Russia

866

850

Spain

437

850

Sweden

437

850

Switzerland (French)

437

850

Switzerland (German)

437

850

Turkey

857

850

United Kingdom

437

850

United States

437

850

Code Page 850

To simplify the exchange of computerized documents between countries, the International Standards Organization (ISO) defined a new code page called 850, for use across national boundaries. This standard, ISO 8859/1, can be used instead of local code pages and reduces the need for code page switching because the sender and the recipient always use the same code page.

Limitations of Code Page 850

In Code Page 850 it was not possible to keep the original code for every character in every local code page. For example, two characters in 437, the Yen ¥ and Cent ¢ signs, have been moved and some graphics characters have been removed to make room for characters frequently used in the other languages.

In most cases you should be able to use either your local code page or the international Code Page 850, but there may be occasions when you need to switch code pages while you work.

Some applications are written specifically for Code Page 437, especially those that use line-drawing characters. These applications may produce displays which are difficult to read when run under Code Page 850. Typically, graphics corners and joints become accented letters.

The following is an example of a display that was intended for use in Code Page 437 and how it looks in Code Page 850.

If you are running an application that uses line-drawing characters that are not available in the code page delivered on your computer, run the application under the code page in which it was written. By switching to the original code page, you get a display that is easier to read.

Summary

Hardware Supported

The operating system supports code page switching on EGA and VGA displays and on the following printers:

Setting Up for Code Page Switching

You can set up your system initially to allow code page switching either when you install the operating system or later using the SETUP program (see Chapter 9, "Configuring the System"). Either way, you configure your system to use code page switching by answering a few questions. You need to

Just follow the on-screen prompts provided.

When you finish installation or SETUP, make sure all printers supporting code page switching are switched on and online before you reboot your system.

When you set up code page switching, certain commands are automatically placed in the CONFIG.SYS and AUTOEXEC.BAT files, reflecting the parameters that you selected. The keyboard, display and printer are set up to use code page switching each time the system is turned on. Fonts for the default code page (which are held in the .CPI files) are downloaded to all the devices that support code page switching.

Example Configuration Files

This section provides an example of a CONFIG.SYS file and AUTOEXEC.BAT file for a system with one printer set up to use Code Page 850 as the default code page.

NOTE: The hardware code page (that is, the character set available as standard with your computer) is always prepared for use. The INSTALL and SETUP programs configure your system to allow one alternative code page. The example files described in this section are set up to allow you to switch from Code Page 850 to the hardware code page by entering the CHCP (Change Code Page) command at the system prompt (see "Working with Code Pages" on page 17-10 in this chapter for a description of CHCP).

A brief explanation of the commands is given below the example. Refer to the "Command Reference" chapter of DOSBook and Chapter 9, "Configuring the System," for detailed descriptions of all the parameters.

Example CONFIG.SYS File

SHELL = C:\COMMAND.COM /P /E:512

BREAK = ON

BUFFERS = 15

FILES = 20

FASTOPEN = 512

LASTDRIVE = E

HISTORY = ON, 256

COUNTRY = 044,850,C:\DRDOS\COUNTRY.SYS

DEVICE = C:\DRDOS\DISPLAY.SYS CON=(EGA,,1)

DEVICE = C:\DRDOS\PRINTER.SYS LPT1=(4201,,1)

COUNTRY.SYS, PRINTER.SYS and DISPLAY.SYS are the drivers that support code page switching.

COUNTRY.SYS

COUNTRY.SYS provides the date and time format appropriate for your country, the currency symbol of your country, and the code page to use. In European countries, for example, the preferred date format is day/month/year whereas in the United States the preferred format is month/day/year and in Japan it is year/month/day.

PRINTER.SYS and DISPLAY.SYS

PRINTER.SYS and DISPLAY.SYS load the drivers for the display and printer. The drivers define the number of code pages (in addition to the hardware code page) that can be used (1 in the example). Memory is set aside for each of these code pages, reducing the memory available to run applications. The maximum number of code pages you can prepare is 12.

Example AUTOEXEC.BAT File

@ECHO OFF

PATH C:\DRDOS

VERIFY OFF

KEYB UK+,850

MODE CON: CODEPAGE PREPARE=((850) C:\DRDOS\EGA.CPI)

MODE LPT1: CODEPAGE PREPARE=((850) C:\DRDOS\4201.CPI)

NLSFUNC

CHCP 850

KEYB, MODE, NLSFUNC and CHCP are the commands that support code page switching.

KEYB

Sets the keyboard nationality and the code page that will be used for the keyboard.

MODE device PREPARE

Prepares a code page for a display or printer. Code pages must be prepared before they can be selected. Several code pages can be prepared for one device in one statement, the maximum being the number defined in the DEVICE=PRINTER.SYS or DEVICE=DISPLAY.SYS statement.

You do not need to prepare the hardware code page. Note that there are other MODE code page options, described in the next section.

NLSFUNC

Provides support for extended country information and enables you to use the CHCP command to select code pages for all devices set up to use them.

CHCP

Selects a code page for all the devices that are set up for code page switching. In the example, 850 will be the active code page when the system is turned on. The keyboard, display and printer will be set up for Code Page 850.

Working with Code Pages

Changing Between Code Pages

When you have set the system up for code page switching, it is simple to switch from the default code page to any other that was prepared (that is, the hardware code page and any other code page defined in a MODE PREPARE command). You do this using the CHCP command.

Loading NLSFUNC

However, before you can use CHCP, NLSFUNC must be loaded. This can be done at installation. Typing NLSFUNC on its own at the command line loads the program if it is not already installed.

To change the code page on all devices, from the system prompt type:

CHCP CP <Enter>

where CP is the number of the code page that you want to use now. When the operation is complete, the system prompt is returned.

The code page is changed on all the devices (displays and printers) that were defined as supporting code page switching in the CONFIG.SYS file.

NOTE: All printers supporting code page switching must be switched on and be online when the CHCP command is used. The system may take some time to report an error if the printer is not switched on or is off-line.

Using MODE SELECT

You can use the MODE SELECT command to change the code page on a single device. If you do this, however, you will find that the country information and some other information used by the device is set up differently to the rest of the system.

Changing a Code Page Temporarily

You may find the MODE SELECT command useful if you want to change a code page temporarily on only part of the system. For example, you may want to display a document in a local code page without printing the document.

Listing your Current Code Pages

You can display currently prepared and selected code pages for screens or printers using the MODE command as follows:

MODE device CODEPAGE [/STATUS]

The selected code page number is displayed, followed by a list of hardware code pages defined in the CONFIG.SYS file and code pages prepared using the MODE PREPARE command.

For example if you type:

MODE LPT1 CP <Enter>

You see a display similar to this:

Active codepage for device LPT1 is 850

hardware codepages:

codepage 437

prepared codepages:

codepage 437

codepage 850

Completed codepage status function

See the "Command Reference" chapter of DOSBook for more information.

Refreshing Lost Code Pages

If you select a code page for a printer, then turn the printer off, the code page information may be lost. If this happens, you can reload the fonts for the active code page on to the printer by using the MODE CODEPAGE REFRESH command:

MODE device CODEPAGE REFRESH

For example:

MODE LPT1 CODEPAGE REFRESH <Enter>

refreshes the code page on the printer connected to port LPT1. See the "Command Reference" chapter of DOSBook for more information.

Code Page 850

Code Page 437



[Front] [Prev Chapter] [Next Chapter]

info@caldera.com
Copyright © 1993, 1997, 1998 Caldera, Inc. All rights reserved.