Doing Japanese on Linux

Steve and Craig's previous article, "Transform Your PC into a Workstation with Linux" (Sept./Oct., page 21), introduced the Linux OS and looked at some of the X-Windows applications that can run on Linux. In this follow-up article, they focus on the Linux JE (Japanese Extension), a set of programs that enables support for Japanese on Linux.

by Steve Myers
and Craig Oda

For those readers who missed our previous article, Linux (pronounced with a short "i," as in "win" -- lin' ucks) is a 32-bit clone of the powerful UNIX operating system (OS). The Linux OS is an ideal method for providing your PC with UNIX workstation capability, including TCP/IP (transmission control protocol/Internet protocol) network support.

Because it is a freeware OS developed by volunteers, with the source code readily available, Linux has quickly become the OS of choice for serious computing enthusiasts who are eager to explore the inner workings of UNIX. Although it lacks some of the robustness of a commercial version of UNIX, Linux has nonetheless proven a viable alternative, even in many corporate situations. (In setting up the Computing Japan Web site recently, Steve used a Linux port of the NCSA HTTPd Web server and the UNIX version of Netscape to test and debug numerous CGI scripts.--Ed.)

Doing UNIX in Japanese

But what about Japanese support? Although UNIX applications are seldom used for creating formatted Japanese documents (this task is usually accomplished much more easily in a Windows or Mac environment), there are still times when Japanese capability on a UNIX system can be advantageous for bilingual users. One obvious benefit is the ability to read Japanese e-mail and the Japanese "fj." USENET postings (pronounced "fuji" by most Japanese).

Japanese versions of standard UNIX word processors, such as emacs and vi, combined with one of a variety of Japanese IMEs (input method editors) allow users to create Japanese text files that can be sent via e-mail or posted to newsgroups. Additionally, a Japanese version of Perl can provide your WWW search engine with instant Japanese capability.

Not surprisingly, Linux is capable of running all of these programs and more. Unlike Windows 3.x, Windows 95, and Windows NT, Linux does not require a separate "Japanese version" of the OS. Support for Japanese is accomplished by simply installing the desired packages from the JE (Japanese Extension) for Linux, which is available both on CD-ROM and via anonymous ftp. (See the "Downloading the Linux JE" sidebar.)

On X-Windows, the key program is a Japanese-capable xterm, called kterm. Within a kterm window, you can read Japanese e-mail on an English version of pine (a popular mailreader originally developed at the University of Washington and installed on most Linux systems). All of these Japanese programs can run on top of an existing English Linux system with the standard X11R6 X-Windows distribution.

Getting started

The entire JE for Linux distribution consists of several packages. The first step toward enabling Japanese on your Linux system is to determine which of the packages you need to install. You will almost certainly need the installation tools on the JE1 disk -- ezinst, konbin, and konfnt -- as well as the base disk set, which contains tools such as less (a Japanese-capable pager) and nkf (used to convert between JIS, Shift-JIS, and EUC code).

To display Japanese on X-Windows, you will need the two-disk set called xclt. If you plan to use a Japanese text editor, mule (an internationalized version of emacs) is a good choice. You must select an input method editor beforehand, since the disks that are required for mule will vary depending on your choice of IME. We recommend the Wnn input method editor -- it is widely used, and relatively easy to learn.

Setting up Linux for Japanese display

To set up your Linux system to handle Japanese, follow the procedure outlined in this section. When you are finished, you will be able to read relevant Japanese e-mail and other documentation, read Japanese USENET postings, and surf the Web in Japanese.

The first disk you will need is the JE1 disk, which contains the following programs:

ezinst: installation program for JE packages

konbin: the kon binary file, used to display kanji on the monitor

konfnt: fonts for kon

You can install JE1 using Slackware's pkgtool (#pkgtool).

Next, start ezinst (note that the menus for this program are all in Japanese). For floppy disk installation, the command would be "#ezinst -fd /dev/fd0."

After the welcome screen, you will be asked to choose which packages you wish to install. One thing that can be a bit confusing here is that "パッケージリスト" (package list) shows the list of packages that you have already chosen for installation. In order to see the list of other packages that you can select from, choose "ルール" (rule). This menu option gets its name from the fact that if you choose a package which requires other packages (such as fonts, libraries, etc.), these packages are selected automatically following the "rules" for that program. This ensures that you have everything you need in order to run any of the programs, and it avoids the problem of installing a multi-disk package only to find out at run-time that you are missing a vital library.

To install the programs necessary for displaying Japanese, make sure that base, xclt, and net (for ktin, the Japanese news reader) are chosen, and then select "インストール" (install) from the previous menu.

After installation is complete, start X-Windows (#startx), then use the xlsfonts command (#xlsfonts | grep jisx0208) to check that you have a usable font. The output from the command should look something like the following:

-jis-fixed-medium-r-normal--0-0-75-75-c-0-jisx0208.1983-0

-jis-fixed-medium-r-normal--16-110-100-100-c-160-jisx0208.1983-0

-jis-fixed-medium-r-normal--16-150-75-75-c-160-jisx0208.1983-0

-jis-fixed-medium-r-normal--24-170-100-100-c-240-jisx0208.1983-0

Next, start kterm (#kterm), which will allow you to display kanji in X-Windows, and try running the ezinst program again from kterm. If the kanji displays correctly this time, then you should now be able to read Japanese from any other programs that are run in the kterm window. The two figures on pages 23 and 24 show pine and Japanese Mosaic, respectively, running in kterm windows.

Note that within kterm, you can press the control key and middle mouse button to call up a menu that allows you to switch between EUC and Shift-JIS encodings.

With kterm, you will eventually be able to read Japanese pages using Netscape 2.0 for UNIX/Linux. The beta version of this software is too buggy to use reliably at the time of this writing, but the menu options indicate that Japanese fonts will finally be supported on this version.

Reading Japanese news

The ktin program included in the net package works nicely for handling the display of Japanese USENET postings. There are, however, a couple of problems you should be aware of:

* ktin will overwrite your English tin in /usr/bin/tin, thus forcing you to always read your news in the Japanese environment.

* ktin calls up the (English) vi editor when you post notes. Since vi cannot display Japanese, you will have to install jvim (the Japanese version) and set a symbolic link from /usr/bin/vi to /usr/local/bin/jvim.

Also, ktin makes use of two important environment variables: KMENU and KCODE. If you work mainly in English, you will probably want to set KMENU to "original." Or, if you are comfortable with Japanese menus, simply set the variable to "Japanese." If you want to accept dial-in and telnet access from users with PCs and Macs, you should set the KCODE variable to "sjis." Otherwise, set it to "euc."

Setting up for Japanese input
and document creation

Eventually, you may find that you wish to create your own Japanese files. Unfortunately, the process of choosing and installing a Japanese text editor and IME for Linux is beyond the scope of this article (Look for a detailed tutorial on this topic in an upcoming issue.), but the basic procedure is similar. These necessary packages can be installed using ezinst.

Be aware, however, that if you set up a text editor such as mule, you will probably spend a fair amount of time referring to the Japanese JE how-to documents. There are different versions of the program for each input method.

Conclusion

Installing Japanese support for your Linux system is a fairly straightforward task. The fact that Linux does not require a special version of the OS for Japanese support is particularly attractive. You will also find that switching in and out of the Japanese environment is quick and simple; it does not require a system reboot, as does Win/V (which is used to provide Japanese support for Windows 3.x systems).

With the basic Japanese support enabled, a number of useful and practical applications will be able to handle Japanese display, including pine, ktin, and Japanese web browsers. If you do a lot of UNIX or Internet-related work in Japanese, the JE extension for Linux is definitely worth a try.

Craig Oda is president of TWICS, Japan's first public-access Internet service. In his spare time, he serves as webmaster for the Tokyo Linux User's Group (TLUG) Web site and listmaster for the TLUG mailing list. Craig's current home system consists of multiple Linux machines linked by Ethernet, which he uses for all of his Internet-related work. Craig can be reached at craig@twics.com.


Do you really need JE?

If you plan to run a Linux Web server and need to be able to handle Japanese HTML documents, but do not have a need for other Japanese applications, it is not necessary to install Japanese Extension. A standard NCSA server will work fine, as the Japanese display will be handled on the client side by the browser.

One of the most useful tools that is included in the base Japanese Extension package is the nkf kanji filter. With nkf, you can easily shift between JIS, Shift-JIS, and EUC encodings:

#nkf -e converts to EUC

#nkf -s converts to Shift-JIS

#nkf -j converts to JIS


Downloading the Linux JE

A good anonymous ftp source from which you can download the Japanese Extension for Linux is:

ftp://sunsite.unc.edu/pub/Linux



System requirements

To be able to input Japanese, you have to be running a kanji server, which requires at least 8MB of memory. Japanese under X-Windows requires 12MB of RAM minimum, with at least 16MB recommended. Expect to use about 40MB of hard disk space just for basic Japanese support.

To save yourself a lot of frustration, don't try using the Linux Japanese Extension on anything less than a 486DX CPU. The article's authors report that they both have achieved satisfactory results using 486DX 33-MHz and 50-MHz machines with 16MB of RAM.





(c) Copyright 1996 Computing Japan