Displaying Japanese Text File with Java

update 16/Jul/1997 [Japanese]

How to display Japanese text file

(1) java.version=1.1 environment only.
Use InputStreamReader to read text files with Japanese native code.
(2) 1.1 development environment (JDK1.1.x etc.) and 1.0.2 displaying environment (Netscape, MSIE etc.).
Use Native2Utf.java to convert Japanese native code to UTF-8 (compacted unicode).
This tool itself never analyzes encoding owing to InputStreamReader.
(3) 1.0.2 environment only.
First, use J2Uc (by Yasushi Kuno) to convert Japanese native code to unicode escape. J2Uc is almost compatible with native2ascii included with JDK 1.1.x.
Second, use Ue2Utf.java to convert unicode escape to UTF-8.
In cases of (2) and (3), you'll have UTF-8 files.
UTF-8 is a flexible length format of unicode (UCS). See more detail of UTF-8 in DataInputStream on JDK 1.1.x API documentation .
readUTF() method of DataInputStream class produces Strings of ordinary fixed length unicode.

Display Test Applet with UTF-8 File

test102.utf

generated by Ue2Utf.java.

test11x.utf

generated by Native2Utf.java


ReadTest.java / DataInputStream2.java
Appearances on Sparc and WinNT

The difference between these display results is comes from difference of handling backslashes.
There is a bug in DataInputStream#readUTF(). DataInputStream2 is a modified class. (update 30/Jun/1997)


File Collection