How to see Japanese characters in java, under ms-windows

Some important things right away

1. I have no idea if it even possible under mswindows 3.1

2. mswindows NT 4.0 supposedly already HAS unicode support. (If it doesn't out of the box, someone please let me know)

3. I now have a possibly working proceedure for jdk1.3

First things first. Let's check if you already have the right fonts installed.
Pull up netscape, and take a peek at www.mainichi.com, or some other site with japanese text chars. You might want to shift-click to "open in new browser window". You might see some characters okay in the menu. beware; those are GIFs! What you care about is the chars in the main body of the page. If you can't highlight them, they are not actual characters.

No luck? Make sure you are set to display them. You have to now go to the "View" menu, then "Language Encoding", and pick "Japanese (Auto-detect)"

Still didn't work? Okay, let's try option 2. Assuming you are using netscape 4, go to the preferences menu. Then click on the fonts section, under Navigator.

Select Japanese instead of Western language. Then see if "MS Gothic" is a font option.

If it is not, you will need an appropriate font.

If you have a recent version of windows, either you already have the needed fonts, or you can use the "windows update" site to get japanese language support. (Hmm.. but this feature apparently doesnt work for XP) (try searching for "IE language pack")

If you have a non-recent version of windows, you may also need to install the IE "internationalization kit" for Japanese (even if you don't have IE installed, or don't use IE!).

An alternative set of japanese fonts can be obtained from Adobe's website.

You can get the microsoft Japanese patch from one of the kanjidic mirror sites. Filename is "ie31pkja.exe". You should also get the other font, MS Mincho, which is under the file "JapSupp.exe", or "JpnSupp.exe". One is "IE japanese support", the other is "MS Office Far East support"

The key thing really is to get the fonts in each package, not neccessarily the packages themselves. But it doesnt hurt to just install them. JDK1.3 actually makes use of BOTH FONTS, so install both of them.

Note for MS-windows 2000 and later

You may instead need/want a file called 'ie_ja.exe'. it can be found on microsoft.com - look for "Japanese language pack for Office XP" or something like that.


Short cut

We now have to tweak configurations files, unfortunately. If you want to avoid hand-editing files, you can try this shortcut. This assumes you either downloaded the ie3lpkja.exe file mentioned, or you already have the "MS Gothic" font available on your system.

First, you need to find where the "font.properties" file is. This files are probably found somewhere like C:/Program files/Javasoft/jre/1.1 You can then copy the "font.properties.ja" file, over to "font.properties", and then things may work for you.

WARNING#1: I have not gotten this to work myself

WARNING#2: This only works for ms-windows, not other OS's. For example, copying over the font.properties.ja file in Solaris most definately does NOT work.

If you're lucky, this copying has enabled you to see Japanese chars. Try running jdrill, and see if you see the appropriate chars at the top. If you do, you're all done!

If this does not let you see japanese chars in jdrill, keep reading!



A cleaner font than MS Gothic

If you want to install other fonts, you will want to read the rest of this page. I personally recommend using a true UNICODE font, described below.

The following covers advice for ms windows95 and NT. Javasoft has a certain amount of advice on the subject (here), but their documentation sux. Here's some hopefully clearer instructions.

STEP 1

First of all, you have to find either a Unicode, or an SJIS(Shift-JIS) font, and install it on your computer. Warning: they can be huge. To install, you may need up to 40 megabytes of hard disk space to install. Once you clean up, the font itself may take up to 13 megabytes or something.

A free unicode font is available, at

http://www.ifcss.org/ftp-pub/software/fonts/unicode/ms-win/cbkanji.exe
ftp://ftp.ifcss.org/pub/software/fonts/unicode/ms-win/cbkanji.exe

Unfortunately, this parent site seems to have gone away, but there are other surviving mirrors for now: Alternate location(s):
HONG KONG http://ftp.cityu.edu.hk/pub/chinese/ifcss/fonts/unicode/ms-win/cbkanji.exe
If this doesnt work, try a web search for cbkanji.exe or cbkanji.zip

Another truetype font I have seen referenced, but not tried, is at http://www.unionway.com/uwjmg3.htm This one is much smaller in download size. (3 megs). But BEWARE: I this is shift-JIS, not unicode.

Truetype fonts, have the "advantage" that it can scale. On the other hand, it takes a LOONG time to load the font, the first time you start up jdrill (and possibly your other java progs). So a fixed size font would actually be preferable in some ways. Unfortunately, I don't know of any freely available ones. Please let me know if YOU know of one.

Run the .exe file to extract the files.

You could read through all the loong readme. Or you could pull up control panel, open up "Fonts", and in the File menu, select "Install new font". It should then copy the .ttf file you just extracted, to the system font directory. After that, you're just about set for the next step:
Getting java to acknowledge it :-/

STEP 2

In the place where you have installed java, which is probably

C:\program files\javasoft\jre\1.1

go and edit the lib\font.properties file. (You'll have to use at minimum "wordpad". SAVE AS TEXT. Notepad wont work until you save it from wordpad first)

Assuming you are using the unicode font I specified in step 1, add the following lines:

#[if dialog.3 is in use, use dialog.4, etc]

#This is the jdk1.1 example
dialog.3=Bitstream Cyberbit
dialoginput.3=Bitstream Cyberbit
serif.3=Bitstream Cyberbit
sansserif.3=Bitstream Cyberbit

Or, if you are using jdk1.2 or later, add these lines

# For jdk1.2 and later
dialog.plain.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialog.italic.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialog.bolditalic.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialoginput.plain.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialoginput.italic.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialoginput.bolditalic.4=Bitstream Cyberbit,DEFAULT_CHARSET


filename.Bitstream_Cyberbit=CYBERBIT.TTF

I highly recommend using the above method! It works!

But it is just the minimum to get jdrill working. If you feel like doing extra work, you could make appropriate lines for serif, sansserif, and monospaced :-)


The rest of this page should only be needed if you have a shift-JIS font

If you want to use a specific Shift-JIS font instead of a nice unicode one, you will have to instead add something similar to;

dialog.3=MS Gothic,SHIFTJIS_CHARSET
dialoginput.3=MS Gothic,SHIFTJIS_CHARSET
serif.3=MS Gothic,SHIFTJIS_CHARSET
sansserif.3=MS Gothic,SHIFTJIS_CHARSET

(This should work with the microsoft font. But it looks ugly.)

NOTE: "your_SJIS_fontname" should simply be the name of the font, as seen by ms-windows programs: NOT the filename.

At this point, hopefully, you're done! You should now be able to properly see Japanese characters under javasoft's java.

Step 3

If this still fails for you, (in particular, with UnsupportedCharset or something similar), perhaps you have the "english-only" version of the java runtime. Go grab the international version of the java runtime.