International Language Environments Guide

System Environment

Locale Environment Variable

To use the en_US.UTF-8 locale environment, choose the locale first. Be sure you have the en_US.UTF-8 locale installed on your system.

How to Use the en_US.UTF-8 Locale Environment
  1. In a TTY environment, choose the locale first, by setting the LANG environment variable to en_US.UTF-8, as in the following C-shell example:


    system% setenv LANG en_US.UTF-8
    

    Make sure that other categories are not set (or are set to en_US.UTF-8) , since the LANG environment variable has a lower priority than other environment variables, such as LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_NUMERIC, LC_MONETARY and LC_TIME have at setting the locale. See the setlocale(3C) man page for more details about the hierarchy of environment variables.

    To check current locale settings in various categories, use the locale(1) utility.


system% locale 
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=

You can also start the en_US.UTF-8 environment from the CDE desktop. At the CDE login screen's Options -> Language menu, choose en_US.UTF-8.

TTY Environment Setup

Depending on the terminal and terminal emulator, such as dtterm(1)that you are using, you may need to push certain codeset-specific STREAMS modules onto your Streams.

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

The following table shows STREAMS modules supported by the en_US.UTF-8 locale in the terminal environment:

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

32-bit STREAMS Module 

Description 

/usr/kernel/strmod/u8lat1

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

/usr/kernel/strmod/u8lat2

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

/usr/kernel/strmod/u8koi8

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

The following table lists the 64-bit STREAMS Modules Supported by en_US.UTF-8.

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

64-bit STREAMS module 

Description 

/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 between UTF-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 64-bit Solaris or 32-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 u8lat1  modulename
system#

If the STREAMS module, such as u8lat1, is already installed, the output looks as follows:


system# modinfo | grep u8lat1
89 ff798000  4b13  18   1  u8lat1 (UTF-8 <--> ISO 8859-1 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/u8lat1 modulename

This loads the 32-bit u8lat1 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/u8lat1

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

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


system# modinfo | grep u8lat1
89 ff798000  4b13  18   1  u8lat1 (UTF-8 <--> ISO 8859-1 module)
system# modunload -i 89

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

Unlike in previous releases of the Solaris operating environment, the dtterm(1) and any other terminals that support input and output of the UTF-8 codeset do not need to have any other additional STREAMS module in their Stream. ldterm(7M) module is now codeset independent and supports Unicode/UTF-8 as well.

For the proper terminal environment setup for the Unicode locales, use the stty(1) utility as follows:


system% stty defeucw

Note -

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


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 <->  ldterm <->  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.


Make sure you already have the STREAMS module loaded into the kernel.

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


system% cat > tmp/mystreams
ttcompat
ldterm
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
ldterm
u8lat1
ptem
pts
system%

To reset 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 usingstty(1), as follows:


system% /bin/stty  defeucw

Note -

Because /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 that .cshrc refers to mystreams instead of creating it whenever you start a C shell.