SunPCi User's Guide

Appendix B SunPCi International Support

SunPCi software gives you the national language support you need to run your applications on an international keyboard. The first time you started the SunPCi program, as described in Chapter 3, Starting SunPCi Software for the First Time, you were presented with a list of regional languages and countries from which to choose. You entered the number that corresponded to the language or country your keyboard supports. These regional languages and country names represent code pages in PC terminology. If you want to change your code pages and leyboard language tables, use the instructions in this appendix.

There are two ways to set up international keyboard support for SunPCi software:

Using the Keyboard Environment Variables

This section describes the following topics:

Setting the KBTYPE Environment Variable

The KBTYPE environment variable specifies the keyboard language table to use with the SunPCi software. To set KBTYPE, refer to Turning On an Environment Variable. Table B–1 lists the values for KBTYPE and the corresponding languages.

Table B–1 KBTYPE Values

KBTYPE Value 

Keyboard Language 

be 

Belgium 

cf 

Canadian French 

dk 

Danish 

fr 

French 

gf 

Swiss German 

gr 

German 

it 

Italian 

la 

Latin American Spanish 

nl 

Dutch (Netherlands) 

no 

Norwegian 

po 

Portuguese 

sf 

Swiss French 

sg 

Swiss German 

sp 

Spanish 

su 

Finnish 

sv 

Swedish 

uk 

U.K. English 

us 

U.S. English 

Setting the KBCP Environment Variable

The KBCP environment variable specifies the keyboard code page. The code page specifies the characters set (accents, currency symbols, and so on) t be used with a keyboard. lists the possible values for the KBCP environment variable.

Table B–2 KBCP Values

Value 

Description 

437 

United States code page 

850 

Multilingual code page, including all characters for most languages of European, North American, and South American countries 

860 

Portuguese code page 

863 

Canadian French code page 

865 

Nordic code page, including all characters for the Norwegian and Danish languages 

To set KBCP, refer to Turning On an Environment Variable. For more information on code pages and their functions, refer to What Is a Code Page? .

Turning On an Environment Variable

To use an environment variable, follow these steps:

  1. Make sure SunPCi is not running, or exit SunPCi if it is running.

  2. Open a terminal window on your desktop.

  3. To set an environment variable, type the following command at the % prompt and press Return (do not type the %). Substitute the name of the environment variable for VARIABLE_NAME, and the value for the variable (if required) for value.

    C Shell:


    % setenv VARIABLE_NAME=value
    

    Bourne Shell:


    % VARIABLE_NAME=value
    % export VARIABLE_NAME
    

  4. Start SunPCi.

Turning Off an Environment Variable

To turn off an environment variable, type the following command and substitute the name of the environment variable for VARIABLE_NAME.


% unsetenv VARIABLE_NAME

How an International Keyboard Works Under DOS

Your Sun international keyboard fully emulates the local-language DOS AT/102 keyboard. Each keyboard offers all the characters in the US-ASCII and the local AT/102 character set, plus any other characters routinely used within that country.

In general, there is nothing unusual about the way this keyboard works for most characters. You press the key and the character appears on the screen. To get an uppercase character, you either hold the Shift key or set the Caps Lock. If there are three characters shown on the key, you hold the Alt-Graph key while pressing the key to get the third character. However, there are a few special ways in which the keyboard operates under DOS:

Windows 95 uses a different keyboard driver than does DOS. If you want to manually set up Windows 95 to support international keyboards under, you will need to load the DOS keyboard driver.


Note –

If you use the environment variables to specify the international keyboard, you will not need to manually set up Windows 95. Refer to Using the Keyboard Environment Variables for more information on the environment variables. For more information on how to perform the manual setup, refer to Setting Device Code Pages .


DOS Character Set

Whenever you, or a program you are using, creates a file under DOS, the DOS character set is used. Whenever you create a file under the Solaris system, the ISO 8859 Latin 1 character set is used. You do not need to be aware of this unless you want to use a DOS file in the Solaris environment, or a Solaris file in the DOS environment. To convert files from one format to the other, two conversion utilities are provided—dos2unix and unix2dos. Only characters that are available in both the DOS character set and the ISO 8859 Latin 1 character set can be converted between formats. Fortunately, most commonly used characters are available in both character sets.

However, if you have a text file that contains special characters, these characters may not be convertible. Most word processors and text-processing programs use special codes in their files to indicate character style or page layout. Most of these programs, however, have options to store the file as “text only” or to “print to a file,” which eliminates the special codes and allows you to convert the file using the dos2unix and unix2dos commands.

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.