Previous Next Contents

3. Applications with Thai characters

This is the tricky part. Most applications support iso_8859_1 characters or 8-bit characters. For example, emacs can display iso_8859_1 character. If we set emacs to display iso_8859_1 and use Thai font, you can edit Thai document with emacs.

You should define the environment LC_CTYPE to iso_8859_1 in /etc/profile (for bash users) and /etc/csh.cshrc (for tcsh users). Similarly you should (for the sake of principle) put something like this in your .Xdefaults or .Xresources file:

*basicLocale:   C
*timeFormat:    C
*numeric:       C
*displayLang:   iso_8859_1
*inputLang:     iso_8859_1

If you use libc-4.x.xx you should set LC_CTYPE to ISO-8859-1 instead of iso_8859_1.

These are some of applications which can use with Thai characters and how to config them. To make X window application displays Thai font, you should run the application with -fn option. For example,

#xterm -fn thai8x16
If you don't want to fill -fn option every time you run application. You should set Thai font in your ~/.Xdefaults or ~/.Xresources like this
XTerm*font:     NameOfThaifont

3.1 Non-network applications

xterm

There are several programs running under xterm such as shell, pine, vi, etc. Don't forget to use Thai font with xterm as I mention above.

bash :

New versions of bash (v1.14.1+) only need to have LC_CTYPE set to iso_8859_1, but if you have problems put the following in your /etc/inputrc or ~/.inputrc file:

set meta-flag on
set convert-meta off
set output-meta on
I actually don't set LC_CTYPE environment variable to iso_8859_1 because this environment variable will effect other applications too. With bash shell, you can specify which environment variable to be passed to the application. I can make tterm (Thai Terminal) with this syntax.
LC_CTYPE=iso_8859_1 xterm -fn thai8x16
It is helpful if you alias the commands like this in .bashrc. This is a part of my .bashrc sample.
alias tterm='LC_CTYPE=iso_8859_1 xterm -fn thai8x16'
alias temacs='LC_CTYPE=iso_8859_1 emacs -fn -etl-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1'
alias ls='ls -F -N --color'

To run xterm with bash shell that accepts Thai characters, you just run tterm. You can type Thai characters in command line. That means you can name filenames in Thai.

tcsh :

Put the following in your /etc/csh.cshrc or .tcshrc file:

setenv LC_CTYPE iso_8859_1
Note: If this doesn't work, your copy of tcsh was probably not compiled with NLS support or possibly it's version 6.03 or lower.

ls :

Issue the command as

ls -N
or possibly
ls --8bit

You may set alias in ~/.bashrc or ~/.cshrc, so you can type ls without option. If you don't use ls with -N option, you may see Thai filename as ?????.

less :

Set the following environment variable:

LESSCHARSET=latin1

emacs

In version 19.26 or later of GNU emacs for X11 you can simply set the environment variable LC_CTYPE to iso_8859_1. If you use an older version or use emacs under plain Linux put the following in your ~/.emacs or the the system-wide initialization file (probably /usr/lib/emacs/site-lisp/default.el):

(standard-display-european t)

(set-input-mode (car (current-input-mode))
        (nth 1 (current-input-mode))
        0) 

If you run emacs already, press Esc-x and type standard-display-european in minibuffer, this command will tell emacs to display 8-bit character.

If you use bash shell you can run emacs in this way,

LC_CTYPE=iso_8859_1 emacs -fn -etl-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1
This will set LC_CTYPE=iso_8859_1 for emacs only.

Because some Thai characters have 0 width, cursor's position may be not in the right place. you should use the fonts from mule. You can get these fonts from

ftp://ftp.fedu.uec.ac.jp/pub/thai/UEC/ZzzThai/Software/UNIX/Fonts/Mule/etl_fonts.tar
Therefore I use the font -etl-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1 in an example.

vi

Vi should be run on xterm that uses Thai font.

xedit

Run xedit with -fn option like xterm. This application can display Thai characters in the right position.

3.2 Network applications

E-mail

You can not send Thai E-mail with mail command. Mail command transfers mail in 7 bit. You should use mail application that supports MIME such as pine or elm.

elm:

Put the following definitions in your ~/.elm/elmrc file:

charset = iso-8859-1
displaycharset = iso-8859-1
textencoding = 8bit
This may not work on some versions of elm.

pine :

Put the following definition in your ~/.pinerc file:

# Reflects capabilities of the display you have. Default: US-ASCII.
# Typical alternatives include ISO-8859-x, (x is a number between 1 and 9).
character-set=ISO-8859-1
This can also be set via the Setup option in pine. You can find it under Config.

tin

Put the following definitions in your ~/.tin/headers file:

Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Now you can post messages with the proper Danish characters in the message body.

lynx

Put the following definition in your ~/.lynxrc file:

character_set=ISO Latin 1
This can also be set via the Options menu in lynx. Type `o' and set the relevant option.

Netscape

If you have Thai fonts in your system. You just select Thai fonts from Options | General Preferences | Fonts. Thai fonts will appear in ISO-8859-1 or in User defined. See http://www.fedu.uec.ac.jp/ZzzThai/unix for setting Thai language on Netscape.

3.3 Thai Applications on X window.

As I know. There are few Thai applications on X window.

Likit is the Thai editor and mail sender (by uuencode) that does not need Thai font. Likit was created by Khun Vuthichai Ampornaramveth. You can find this application from thaigate site.

If you are using Tex or Latex, you may want to use Thai Tex. This is the work of Dr. Manop Wongsaisuwan and his friends at Tokyo Institute of technology. You can also find Thai tex on http://thaigate.nacsis.ac.jp/files/ttex.html.

Txterm, this is Thai xterm version. I don't know much about this.

Xzthai, this is the Tcl/Tk application for mapping Thai keyboard on US keyboard with graphical user interface. Also provides simple editor and keyboard layout figure. You need to have Thai font. It actually uses xmodmap program in background to map US keyboard and Thai keyboard. This program was created by me. See http://www.fedu.uec.ac.jp/ZzzThai/xio/xzthai.html

3.4 Other Tips.

Now you can configure the applications to be more Thai environment. Because Xt based applications allows user to configure the applications by resources. We can make the menu or label to be Thai language.

For example, if you want xman to display Thai labels. You may add these lines in your .Xdefaults

......
!!  Xman section
Xman*Font:                          thai8x16
Xman*helpButton.Label:              ªèÇÂ
Xman*quitButton.Label:              ÍÍ¡
Xman*manpageButton.Label:           ¤ÙèÁ×Í¡ÒÃãªé
......


Previous Next Contents