-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.1.4
-
x86
-
solaris_2.6
Name: rm29839 Date: 11/12/97
import java.io.*;
// This program demonstrates a bug in OutputStreamWriter when using JIS
// The correct output of this program should be
// ESC $ B $ 4 ESC ( B ESC $ B $ _ ESC ( B
// or something equivalent like
// ESC $ B $ 4 $ _ ESC ( B
// However, it outputs
// ESC $ B $ 4 ESC ( B $ _ ESC ( B ESC ( B
// which is erroneous.
public class Jisbug {
public static void main (String args[]) {
int c;
StringReader in;
OutputStreamWriter out;
try {
in = new StringReader ("\u3054\u307f");
out = new OutputStreamWriter (System.out, "JIS");
while ((c=in.read()) > 0) {
out.write (c);
}
in.close ();
out.close ();
} catch (UnsupportedEncodingException e) {
System.err.println ("One or more unsupported encodings");
} catch (IOException e) {
e.printStackTrace();
}
}
}
(Review ID: 19524)
======================================================================
- duplicates
-
JDK-4091050 Off-by-one and other errors in sun.io.CharToByteJIS
-
- Closed
-