How to use Japanese in the computer abroad

draft (95/09/20)
update (96/04/28) for Otsu-san
update (97/08/07)
by Hiraku Nakajima (nakajima@kusm.kyoto-u.ac.jp)
This document tells you a way to read or write Japanese characters in abroad. I understand that when you are in abroad, you want to escape from everything (duties, noisy friends, etc.) in Japan. But sometimes you may want to read e-mails from Japanese, Japanese news,... In fact, it is not so difficult. The followings are based on my experiences.

In the following, I assume that the name of the computer which you are using in abroad is ebira.mars.edu, and the name of the computer in Japan is take.math.tohoku.ac.jp. Replace the names according to your system. And "ebira~%" and "take~%" are prompts of those computers, which show you to which computer you must enter the command.

The preliminary knowledge to understand this document is only basic commands for Unix. You cannot do more than what you can do in Japan, of course.

1. If you can use only the termial (not X-window),.....

It is impossible to display KANJI characters in the console. The only solution is to use ROMAJI. In usual, it is not so convenient to use ROMAJI in long documents, so to use ROMAJI is the last choice. If you can use some kinds of window systems, then try to proceed the case 2.

There is a method to translate KANJI to ROMAJI. So it is impossible to write KANJI but you can read ! The solution is to use "kakasi". For example, if "gegege" is written in KANJI characters, you can translate it to ROMAJI simply by

 take~% kakasir < gegege
The result is, for example, like this:
 kuroki gen ha futsuu no hito denai .
kakasir is the following shell script. If you only have kakasi, you must set options appropriately.
 #!/bin/sh
 cat $@| kakasi -Ha -Ka -Ja -Ea -ka -s | sed 's/ESC<2E>.//g'
Unfortunately the man(manual command for Unix) for kakasi is written in Japanese ! So you must understand options before you are in abroad.

NB. If "kakasi" is not installed in your system, you cannot use this solution. You must ask the system administrator to install, or just install by yourself.

2. If you can use the X-window system,....

If you can use the X-window system, you have chances to read and write Japanese charcters.

2-1. Netscape

First of all, if you can use the X-window system, it is rather easy to use Netscape to read Japanese.

When you want to read Japanese in Netscape, you must set the document encoding code (in the option menu) to Japanese (Auto-Detect is fine usually).

My favorite site is

http://www.asahi.com
I can read Japanese News every day !

NB. If you do not need to see pictures, you just use w3.el in mule (see below, for the usage of mule) to browse www servers. This is faster than Netscape.

It should be possible to read mails from Netscape. I do not use Netscape Mail, so I could not explain about it.

For Netscape, the program installed in the machine abroad can handle Japanese characters. But for most of other programs, like xterm, emacs, etc, could not handle Japanese characters. So you must use programs which can be handle them.

You have two solutions. One is easier but the responce is slow, and the other needs some efforts but the responce is very good.

2-1. Easier solution

First let me explain the first easier solution. This is just access to your home computer in Japan, and use it as the X-host.
  1. From your computer running the X-system, put
     ebira:~% xhost + take.math.tohoku.ac.jp
    
  2. Login the computer in Japan. And put
     take:~% setenv DISPLAY ebira.mars.edu:0.0
    
    This command tells "take" to display to the "ebira"'s screen.
  3. Just put
    take:~% kterm
    
Then you will find the kterm window in your screen. However, when the network speed is not high enough, it takes some time to appear. And after beginning to use, the responce is very slow. This is because all codes are sent via the network. If you want to use Japanese characters more efficiently, you should proceed 2-2. In my experiences, this method is useless because I must wait minutes to get kterm screen. But Takebe-san told me he used this method between Berkeley and Tokyo without stress.

2-2. A little difficult: Installation of Kterm

It is not difficult to install some Japanese programs in your system in abroad. If the hardware is the same, you can just get the binary files by ftp. If different, you just get the source code, and compile in your system. The latter is more stable, of course. So I recommend the latter method. The most essential program should be the terminal software which can handle Japanese characters, which is called kterm.

In order to read Japanese code in kterm, you need Japanese fonts. But they are attached with the X-window system. Thus unless the system administrator deleted them, you do not need to install fonts. (Japanese fonts are placed at /usr/X11R6/lib/X11/fonts/misc/. You must find k14.pcf, etc.)

Put the binary of kterm in the place which your PATH indicates,

 ebira~% kterm -fn 7x14 -fr rk14 -fk k14 -sb
The options determines the Japanese fonts you use. If you want to use other fonts, just replace !

Once you installed kterm, you can use all programs installed in your home computer, unless it displays characters in another window. For example, if you want to use mule, you just put

 take~% mule -nw
The option -nw means no window. Otherwise, mule try to make new window. It send X-codes through network (cf. 2-1 Easier solution).

You can use any other programs which displays charcters on kterm. Thus this solution is enough for almost all purpose, I think.

3. More installation

As I said above, the method explained in 2-2 satisfies almost all of your desires, I believe. In my cases, if my stay is just only several weeks, I use the method 2-2.

However, if the network speed is very slow, it is painful to access your home computer in Japan. Sometimes, it is even impossible to login because of time out. Then the only solutions are

  1. Access when the network is *NOT* crowded. In the night (in Japan), the network is crowded. Try other time.
  2. Install programs in the computer in abroad by yourself.
I will explain the second solution.

For example, in order to read/send mails, you just install mule/nemacs and skk. If you want to use TeX with Kanji characters you must install jtex and xdvi.

3-1. mule/nemacs & skk

If you want to read/input Kanji characters in your computer in abroad, you must install mule/nemacs and skk. As you might already know, emacs used in abroad cannot display kanji characters. Skk is the front end processor which has nothing to do with algebraic analysis. Other front end processor such as Wnn, Egg cannot be used unless you are root. So usually skk is the only choice. The detailed document for installation of these programs are attached, so I do not try to reproduce it.

3-2. JTeX

If you want to use TeX with kanji characters, first you must install jtex and xdvi as you do in Japan. I do not explain about it. But you still have problem since you cannot print out unless you have printer which can produce Kanji characters. Proceed to the next section !

4. Printing

Printers abroad do not have kanji fonts. So the only solutions are
  1. Bring your printer to abroad.
  2. Print out Kanji characters as graphic.
I will explain the second solution. However, it may fail because data become too big. I have tried several printers, and it seems that you need good enough printers (enough memory ?). Good luck !

For the second solution, you need

  1. fonts for Japanese characters, and
  2. programs which can handle the above fonts.
For the first, I use watanabe-jfonts, which was used to print out Japanese dvi files several years ago. These are large font files! I do not try to tranfer them to abroad. I send a file to the home computer via ftp and translate it into the suitable postscript file there.

Anyway, you must install watanabe-jfonts to the suitable place which can be found by the program dvi2ps.

There may be other solutions using vector fonts. But I do not know.

4-1. Printing Usual files

Use the program called k2ps.
 take~% k2ps hogehoge > hogehoge.ps
This is very similar to the program called a2ps. It translate a file (hogehoge) which contains kanji characters into a postscript file.

4-2. Printing Dvi files

The strategy is to produce a postscript file from a dvi file without using built-in Kanji fonts in the printer. I explain the method using dvi2ps. (There may be a method using dvips.) The program dvi2ps selects fonts according to the font description file. The program usually uses the default file (file name = fontdesc, located somewhere). In order to avoid the built-in fonts, you first copy the default file to another file (e.g., my-fontdesc). Then comment out the following part:
builtin dm%j SINR Ryumin-Light-H
builtin dg%j SINR GothicBBB-Medium-H 
(There might be little difference.) Then you run
 take~% dvi2ps -Fmy-fontdesc hogehoge.dvi > hogehoge.ps
I only have watanabe-jfonts for NTT-JTeX. (Are there for ASCII-JTeX ?) If you use ASCII-JTeX (as myself), you first use dvi2dvi to translate an ASCII-JTeX dvi file into an NTT-JTeX dvi file.

Acknowledgement:Almost all these know-how are taught me by Kuroki-san in Tohoku University. Some comments are due to Takebe-san in University of Tokyo. I would like to thank both very much.