-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: skT88420 Date: 08/25/99
1.Japanese SJIS encoding and decoding is wrong in some cases.
This appear when handling SJIS charactar 8160 , 8161 , 817c (Hex) .
2.source code
----------------from----------------
import java.io.*;
public class MyTest
{
public static void main(String[] args)
{
try{
BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream("in.txt"),"SJIS"));
BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("out.txt"),"SJIS"));
for(String strRead=reader.readLine();strRead!=null;strRead=reader.readLine())
{
System.out.println(strRead);
writer.write(strRead);
writer.newLine();
}
writer.flush();
writer.close();
reader.close();
}catch(IOException ex){
System.out.println(ex);
ex.printStackTrace();
}
}
}
--------------------to-------------------
Notice.
To run above code, you will have to prepare in.txt with
code SJIS charactar 8160 , 8161 , 817c (Hex).
This code will display wrong char '?'.
3.text of error message is like this.
(Sorry. They are Japanese SJIS charactars)
815a: =81Z
815b: =81[
815c: =81815d: =81]
815e: =81^
815f: =81_
8160: =81`
8161: =81a
8162: =81b
8163: =81c
8164: =81d
817c: =81|
5.This problem appears in J2SDK1.3 beta.
This probrem also appears in JDK1.1.x and JDK1.2.x.
6.Additional information.
lower 2 different code behave different result
only in case SJIS charactar 8160 , 8161 , 817c (Hex).
BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("out.txt")));
BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("out.txt"),"SJIS"));
I think this "DEFAULT" encoding is diferrent to
default "SJIS" encoding.
7.To japanese reader.
=89p=8C=EA=82=CD=8B=EA=8E=E8=82=C5=82=B7
(Review ID: 94356)
======================================================================