SunPCi User's Guide

Code Pages and SunPCi Software

DOS provides national language support through the use of language-specific code pages. The first time you start the SunPCi program, code pages are set for you when you are presented with a screen that instructs you to enter the number of the country matching your keyboard.

If you want to change code pages at some time, follow the instructions in the section Using Code Pages in DOS or use the KBCP environment variablem as described in Setting the KBCP Environment Variable.

What Is a Code Page?

A code page is a table that defines the character set you are using. Each character set contains 256 entries specific to a country or language. The characters are translated from the code page table and used by your keyboard, screen, and printer. An example is the set of letters, numbers, and symbols (such as accent marks) used by French-Canadians. When the character set is put into a table for use by DOS, it becomes the Canadian-French code page.

There are two types of code pages, hardware and prepared. A hardware code page is built into a device. For example, a printer manufactured for use in Portugal has a Portuguese hardware code page in it. Many devices can use only their own hardware code page.

Prepared code pages are provided in code-page information (.CPI) files in your software. OpenDOS includes the following prepared code pages:

Devices Supporting Multiple Languages

The following devices can use prepared code pages to switch from one language to another:

For example, you have EGA support with the SunPCi program that allows you to switch between the United States code page and the Multilingual code page by entering the appropriate DOS commands. With prepared code pages, a single system can support multiple national languages.

National Language Support Codes

When you use commands to set up your system for a national language, DOS makes sure the screen, printer, and keyboard codes you request work together. The valid combinations of prepared code pages, country codes, and keyboard codes are defined in the COUNTRY.SYS and KEYBOARD.SYS files. The supported combinations are listed in Table B–3.

Both Swiss French and Swiss German use country code 041. Country codes 358 and 972 assume United States code page 437, but include country-specific date and time conventions. For example, if you use country code 351 (Portugal), you can use prepared code pages 860 and 850 and the po (Portugal) keyboard code. You could not use the us (United States) keyboard code. If you enter a country code 002 with a us keyboard code, DOS displays an error message when you restart the system.

Table B–3 National Language Support

Country, Region, or Language 

Country Code 

Prepared Code Pages 

Key Code 

United States 

001 

437, 850 

us  

Canadian-French 

002 

863, 850 

cf  

Latin America 

003 

437, 850 

la  

Netherlands 

031 

437, 850 

nl  

Belgium 

032 

437, 850 

be  

France 

033 

437, 850 

fr  

Spain 

034 

437, 850 

sp  

Italy 

039 

437, 850 

it  

Switzerland 

041 

437, 850 

sf, sg  

United Kingdom 

044 

437, 850 

uk  

Denmark 

045 

865, 850 

dk  

Sweden 

046 

437, 850 

sv  

Norway 

047 

865, 850 

no  

Germany 

049 

437, 850 

gr  

English (International) 

061 

437, 850 

-  

Portugal 

351 

860, 850 

po  

Finland 

358 

437, 850 

su  

Israel 

972 

437 

-  

Japan 

081 

 

ja  

Korea 

082 

 

ko  

Peoples Republic of China 

086 

 

ch  

Taiwan 

088 

 

tn  

Using Code Pages in DOS

The following sections explain the basics of using code pages, including how to set up your system to support a particular character set. Also, several examples, using different hardware and prepared code pages, are provided. The examples show you how to manually set up your system to support national languages. It is assumed that all DOS files are in the directory \dos on drive C:.


Note –

You can also set up the code pages by using the KBCP environment variable with SunPCi, as described in Setting the KBCP Environment Variable.


Manually Setting the System Code Page

DOS uses the AUTOEXEC.BAT and CONFIG.SYS files to set up system code pages to support a national language. Examples of CONFIG.SYS commands are shown later in this chapter. Remember, when you change your CONFIG.SYS file, you must reboot the SunPCi window to enable the new settings.

To set up your system to support a character set, follow this procedure.

  1. In your CONFIG.SYS file, perform the following steps:

    1. Use the country configuration command to control country-specific characteristics such as the time format, date format, currency symbol, and character-sorting sequence.

    2. Use a device configuration command to tell DOS the hardware code page is a device and to allocate buffers for prepared code pages.

    3. Use an nlsfunc command to load the memory-resident national support functions. If you forget to issue the nlsfunc command, DOS will not allow you to specify code pages or keyboard codes.

  2. In your AUTOEXEC.BAT file, use the following commands:

    1. Use a mode cp prepare command to prepare code pages for each device that supports code-page switching.

    2. Use a keyb command to select the keyboard layout.

    3. Use a chcp command to select the code pages for all prepared devices. DOS automatically prepares two system code pages and selects the primary code page for your country. If you want to use the other code page prepared for your country, you can use the chcp command again.

Setting Country and Keyboard Codes

The first example uses only a hardware code page; code-page switching is not used. The commands tell DOS to accept the country information for France and load the French keyboard program. This example is similar in most European countries.

To the end of your CONFIG.SYS file, add the following line:


country=033,,c:\dos\country.sys 

To the AUTOEXEC.BAT file, add the following line:


keyb fr,,c:\dos\keyboard.sys 


Note –

The default AUTOEXEC.BAT file contains two lines at the end of the file that invoke AUTOEXEC.BAT files on the E: or H: drive. If your AUTOEXEC.BAT file still contains these lines, place the international command lines before them.


Using Hardware and Prepared Code Pages

The next example uses two code pages—one hardware and one prepared. In this instance, the system you are setting up uses the German code page provided in the EGA and the United States code page provided by DOS.

To the end of your CONFIG.SYS file, add the following on separate lines:


country=049,,c:\dos\country.sys
device=c:\dos\display.sys con:=(ega,437,1)
install=c:\dos\nlsfunc.exe c:\dos\country.sys

These CONFIG.SYS statements tell DOS that the hardware code page (437) in the Enhanced Graphics Adapter should be used, and that you are allocating space for one prepared code page. Also, they load memory-resident, national support functions.

To the end of your AUTOEXEC.BAT file, add the following exactly as shown (on separate lines):


mode con cp prep=((437)c:\dos\ega.cpi)
keyb gr,,c:\dos\keyboard.sys
chcp 437

These AUTOEXEC.BAT commands do the following:

Setting Device Code Pages

The following two sections describe two methods for setting a code page for a specific device, including a console screen and a printer.

Setting Screen Code Pages

This example uses two prepared code pages—no hardware code pages are used—to set up the system to support Denmark/Norway and the Multilingual national languages.

To the end of your CONFIG.SYS file, add the following on separate lines:


country=045,,c:\dos\country.sys
device=c:\dos\display.sys con:=(ega,,2)
install=c:\dos\nlsfunc.exe c:\dos\country.sys

These CONFIG.SYS commands tell DOS that the EGA's hardware code page is not used, and that you are allocating space for two prepared code pages. Also, they load memory-resident, national support functions.

To the AUTOEXEC.BAT file, add the following exactly as shown (on separate lines):


mode con cp prep=((865,850) c:\dos\ega.cpi) 
keyb dk,,c:\dos\keyboard.sys 
chcp 865 


Note –

If the AUTOEXEC.BAT file contains two lines at the end of the file that invoke AUTOEXEC.BAT files on the E: or H: drive, place the international command lines before these lines.


These AUTOEXEC.BAT commands do the following:

Setting Parallel Printer Code Pages

The second example also uses two prepared code pages. It assumes you have an IBM Proprinter model 4201 connected to LPT1. The system is set up to support Denmark/Norway and the Multilingual national languages.

To the end of your CONFIG.SYS file, add the following on separate lines:


country=045,,c:\dos\country.sys 
device=c:\dos\display.sys con:=ega,,2 
device=c:\dos\printer.sys lpt1:=4201,,2 
install=c:\dos\nlsfunc.exe c:\dos\country.sys

These CONFIG.SYS commands tell OpenDOS that the hardware code page is not used, and that you are allocating space for two prepared code pages in each device. Also, they load memory-resident, national support functions.

To the AUTOEXEC.BAT file, add the following on separate lines:


mode con cp prep=((865,850)c:\dos\ega.cpi) 
mode lpt1 cp prep=((865,850)c:\dos\4201.cpi) 
keyb dk,,c:\dos\keyboard.sys 
chcp 865 


Note –

If the AUTOEXEC.BAT file contains two lines at the end of the file that invoke AUTOEXEC.BAT files on the E: or H: drive, place the international command lines before these lines.


These AUTOEXEC.BAT commands do the following:

Switching Between Code Pages

After using the CONFIG.SYS and AUTOEXEC.BAT file commands to set up your system for multiple national languages, use the following command to change to a different code page on all devices or for a single prepared device:


C:\> chcp code page 

or


C:\> mode device cp select=code page 

where:

code page is one of the pages set up in AUTOEXEC.BAT and device is CON or LPT1.

Listing Current Code Pages

You can list the current prepared and selected code pages for your console screen or a parallel printer by using the mode command in the following form:


C:\> mode device cp

Displaying Current Device Code Pages

To display the current code pages for your console screen device, enter the following:


C:\> mode con cp

OpenDOS displays a message similar to this one:


Example B–1 OpenDOS Output

Active code page for device CON is 437hardware code
pages:	Code page 850prepared code pages: 	Code page 437 	Code page
850 	Code page not prepared 	Code page not prepared MODE Status
Code page function completed 

Refreshing Lost Code Pages

It is possible for prepared code pages to be lost due to hardware errors. For example, suppose you had selected the Canadian-French code page (863) as the active code page for your console screen (CON). But, because of a hardware error, the active code page was lost. You can use the refresh keyword with the mode command to restore the lost code page for your screen, by entering the following:


C:\> mode con cp refresh 

The $LANG Variable

There are two Solaris commands—/usr/bin/dos2unix and /usr/bin/unix2dos—that enable you to specify code pages. For example, to convert the task_list file, created with code page 850, from a DOS to a Solaris format, use the dos2unix command, and enter the following:


C:\> dos2unix -850 task_list task_list  

If the code page is not specified on the command line, dos2unix and unix2dos will check the $LANG environment variable to determine which code page to use. To check whether your $LANG variable is set, enter the following in a Solaris command window:


% env | grep LANG

If you do not have the $LANG variable set, or if it is set to anything but the settings listed in Table B–4, SunPCi software uses the default US code page 437 and the en_US (English-US) $LANG setting.

Table B–4 $LANG Variable Settings

$LANG Variable Setting

Language/Territory 

Default “C” locale 

es_AR 

Arabic 

da 

Danish 

de 

German 

de_AT 

Austrian German 

de_CH 

Swiss German 

el 

Greek 

en_AU 

Australian English 

en_IE 

Irish English 

en_NZ 

New Zealand English 

en_UK 

UK English 

en_US 

US English 

es 

Spanish 

es_BO 

Bolivian Spanish 

es_CL 

Chilean Spanish 

es_CO 

Colombian Spanish 

es_CR 

Costa Rican Spanish 

es_EC 

Ecuadorian Spanish 

es_GT 

Guatemalan Spanish 

es_MX 

Mexican Spanish 

es_NI 

Nicaraguan Spanish 

es_PA 

Panamanian Spanish 

es_PE 

Peruvian Spanish 

es_PY 

Paraguayan Spanish 

es_SV 

Salvadoran Spanish 

es_UY 

Uruguayan Spanish 

es_VE 

Venezuelan Spanish 

fr 

French 

fr_BE 

Belgian French 

fr_CA 

Canadian French 

fr_CH 

Swiss French 

it 

Italian 

ja 

Japanese 

ko 

Korean 

sv 

Swedish 

zh 

Chinese 

zh_TW 

Chinese Taiwan 

Note that the settings listed in the table are the ones that SunPCi supports; it does not list all the languages Solaris supports.