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 NameOfThaifont
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 reccomend you to use ~/.inputrc because Thai character set is 8-bit but not exactly iso-8859-1. You should avoid to set LC_CTYPE as ISO_8859_1 if you can.

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

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.

telnet

Put one line of the following type in your ~/.telnetrc file for each host you want to log on to using telnet:

<hostname> set outbinary true
Example:
localhost set outbinary true
foo.bar.dk set outbinary true

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.


Previous Next Contents