Solaris Internationalization Guide For Developers

TTY Environment Setup

To ensure correct text edit operation by a terminal or by a terminal emulator such as dtterm(1), users should push certain locale-specific STREAMS modules onto their Streams.

For more information on STREAMS modules and streams in general, see the STREAMS Programming Guide.

Table 4-1 shows STREAMS modules supported by the en_US.UTF-8 locale in the terminal environment:

Table 4-1 32-bit STREAMS Modules Supported by en_US.UTF-8

32-bit STREAMS Module 

Description 

/usr/kernel/strmod/eucu8

UTF-8 STREAMS module for tail side

/usr/kernel/strmod/u8euc

UTF-8 STREAMS module for head side

/usr/kernel/strmod/u8lat1

Code conversion STREAMS module betweenUTF-8 and ISO 8859-1 (Western Europe)

/usr/kernel/strmod/u8lat2

Code conversion STREAMS module between UTF-8 and ISO 8859-2 (Eastern Europe)

/usr/kernel/strmod/u8koi8

Code conversion STREAMS module betweenUTF-8 and KOI8-R (Cyrillic)

Table 4-2 lists the 64-bit STREAMS Modules Supported by en_US.UTF-8.

Table 4-2 64-bit STREAMS Modules Supported by en_US.UTF-8

64-bit STREAMS module 

Description 

/usr/kernel/strmod/sparcv9/eucu8

UTF-8 STREAMS module for tail side

/usr/kernel/strmod/sparcv9/u8euc

UTF-8 STREAMS module for head side

/usr/kernel/strmod/sparcv9/u8lat1

Code conversion STREAMS module betweenUTF-8 and ISO 8859-1 (Western European)

/usr/kernel/strmod/sparcv9/u8lat2

Code conversion STREAMS module between UTF-8 and ISO 8859-2 (Eastern European)

/usr/kernel/strmod/sparcv9/u8koi8

Code conversion STREAMS module betweenUTF-8 and KOI8-R (Cyrillic)

Loading a STREAMS Module at Kernel

To load a STREAMS module at kernel, first become root:


system% su
Password:
system#

To determine whether you are running a 32-bit Solaris or 64-bit Solaris system, use the isainfo(1) utility as follows:


system# isainfo -v
	64-bit sparcv9 applications
	32-bit sparc applications
	system#

If the command returns this information, you are running the 64-bit Solaris system. If you are running the 32-bit Solaris system, the utility shows the following:


system# isainfo -v
	32-bit sparc applications
	system#

Use modinfo(1M) to be certain that your system has not already loaded the STREAMS module:


system# modinfo | grep eucu8modulename

If the STREAMS module, such as eucu8, is already installed, the output will look as follows:


system# modinfo | grep eucu8
89 ff798000  4b13  18   1  eucu8 (eucu8 module)
system#

If the module is already installed, you don't need to load it. However, if the module has not yet been loaded, use modload(1M)as follows:


system# modload /usr/kernel/strmod/eucu8modulename

This loads the 32-bit eucu8 STREAMS module at the kernel, so you can push it onto a Stream. If you are running the 64-bit Solaris product, use modload(1M) as follows:


system# modload /usr/kernel/strmod/sparcv9/eucu8

The STREAMS module is installed at the kernel, and you can now push it onto a Stream.

To unload a module from the kernel, use modunload(1M), as shown below. In this example, the eucu8 module is being unloaded.


system# modinfo | grep eucu8
89 ff798000  4b13  18   1  eucu8 (eucu8 module)
system# modunload -i 89

dtterm and Terminals Capable of Input and Output of UTF-8 Characters

The dtterm(1) and any terminal that supports input and output of the UTF-8 codeset should have the following STREAMS configuration:


head <-> ttcompat <-> u8euc <->  ldterm <-> eucu8 <-> pseudo-TTY

In this example, u8euc and eucu8 are the modules supported by the en_US.UTF-8 locale. Make sure you already loaded the STREAMS modules into the kernel as specified in the previous section.

To set up the above STREAMS configuration, use,strchg(1) as shown below:


system% cat > /tmp/mystreams 
ttcompat
u8euc
ldterm
eucu8
ptem
^D
system% strchg -f /tmp/mystreams

When using strchg(1) , be sure you are either root or the owner of the device. To see the current configuration of STREAMS, use strconf(1) as shown below:


system% strconf
ttcompat
u8euc
ldterm
eucu8
ptem
pts
system%

To revert to the original configuration, set the STREAMS configuration again as shown below:


system% cat > /tmp/orgstreams
ttcompat
ldterm
ptem
^D
system% strchg -f/tmp/orgstreams

Terminal Support for Latin-1, Latin-2, or KOI8-R

For terminals that support only Latin-1 (ISO 8859-1), Latin-2 (ISO 8859-2), or KOI8-R, you should have the following STREAMS configuration:


head <-> ttcompat <-> u8euc  <-> ldterm <-> eucu8 <-> u8lat1 <-> TTY

Note -

This configuration is only for terminals that support Latin-1. For Latin-2 terminals, replace the STREAMS module u8lat1 with u8lat2. For KOI8-R terminals, replace the module with u8koi8.


To set up the STREAMS configuration shown above, use strchg(1), as follows:


system% cat > tmp/mystreams
ttcompat
u8euc
ldterm
eucu8
u8lat1
ptem
^D
system% strchg -f /tmp/mystreams

Be sure that you are either root or the owner of the device when you use strchg(1). To see the current configuration, usestrchg(1) , as follows:


system% strconf
ttcompat
u8euc
ldterm
eucu8
u8lat1
ptem
pts
system%

To revert to the original configuration, set the STREAMS configuration as follows:


system% cat > /tmp/orgstreams
ttcompat
ldterm
ptem
^D
system% strchg -f  /tmp/orgstreams

Setting Terminal Options

To set up the UTF-8 text edit behavior on TTY, you must first set some terminal options using stty(1) as follows:


system% /bin/stty cs8 -istrip defeucw

Note -

Since /usr/ucb/stty is not yet internationalized, you should use /bin/stty instead.


You can also query the current settings using stty(1) with the -a option, as shown below:


system% /bin/stty -a

Saving the Settings in ~/.cshrc

Assuming the necessary STREAMS modules are already loaded with the kernel, you can save the following lines in your .cshrc file (C shell example) for convenience:


setenv LANG en_US.UTF-8
if ($?USER != 0 && $?prompt != 0) then
				 cat >! /tmp/mystreams$$ << _EOF
				 ttcompat
				 u8euc
				 ldtterm
				 eucu8
				 ptem
_EOF
				 /bin/strchg -f /tmp/mystream$$
				 /bin/rm -f /tmp/mystream$$
				 /bin/stty cs8 -istrip defeucw
endif

With these lines in your.cshrc file, you do not have to type all of the commands each time. Note that the second _EOF should be in the first column of the file. You can also create a file called mystreams and save it so the .cshrc references to mystreams instead of creating it whenever you start a C shell.