-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.4.2_13
-
None
-
sparc
-
solaris_8
This is from Bank of New York, case 65349268.
Cu has to upgrade from 1.2.2 to 1.4.2 for the DST fix.
The following test program demonstrates that in 1.2.2, the broken
vertical line "\246" character is interpreted correctly regardless of
input/output encodings. But with 1.3.1 or above, the test only works
correctly if both input and output encodings -> 8859_1.
Please see test program below and the input file from attachment
in this bug report.
jdk 1.2.2_17:
% java test2 8859_1 8859_1 < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 8859_1
broken vertical bar displayed as: ¦
% java test2 8859_1 646 < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 646
broken vertical bar displayed as: ¦
% java test2 646 646 test < input
Default system encoding is 646
input encoding of 646
output encoding of 646
broken vertical bar displayed as: ¦
jdk 1.4.2_13:
% java test2 8859_1 8859_1 < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 8859_1
broken vertical bar displayed as: ¦
% java test2 8859_1 646 test < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 646
broken vertical bar displayed as: ?
% java test2 646 646 < input
Default system encoding is 646
input encoding of 646
output encoding of 646
broken vertical bar displayed as: ?
// java file to run as a filter, converting ISO-8859-1 to UTF-8...
//modified from Java in a Nutshell v 1.1, p208
import java.io.*;
public class test2
{
public static void main(String []args) throws Exception
{
System.out.println("Default system encoding is " + System.getProperty("file.encoding"));
String inEncoding = null, outEncoding = null;
if (args.length > 0){
inEncoding = args[0];
outEncoding = args[1];
System.out.println("input encoding of " + inEncoding);
System.out.println("output encoding of " + outEncoding);
}
//InputStreamReader and friends do charset conversion
InputStreamReader in = new InputStreamReader(System.in, inEncoding);
OutputStreamWriter out = new OutputStreamWriter(System.out, outEncoding);
Reader r = new BufferedReader(in);
Writer w = new BufferedWriter(out);
char []buffer = new char[4096];
int len = 0;
while ((len = r.read(buffer)) != -1)
w.write(buffer, 0, len);
r.close();
w.flush();
w.close();
}
}
Cu has to upgrade from 1.2.2 to 1.4.2 for the DST fix.
The following test program demonstrates that in 1.2.2, the broken
vertical line "\246" character is interpreted correctly regardless of
input/output encodings. But with 1.3.1 or above, the test only works
correctly if both input and output encodings -> 8859_1.
Please see test program below and the input file from attachment
in this bug report.
jdk 1.2.2_17:
% java test2 8859_1 8859_1 < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 8859_1
broken vertical bar displayed as: ¦
% java test2 8859_1 646 < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 646
broken vertical bar displayed as: ¦
% java test2 646 646 test < input
Default system encoding is 646
input encoding of 646
output encoding of 646
broken vertical bar displayed as: ¦
jdk 1.4.2_13:
% java test2 8859_1 8859_1 < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 8859_1
broken vertical bar displayed as: ¦
% java test2 8859_1 646 test < input
Default system encoding is 646
input encoding of 8859_1
output encoding of 646
broken vertical bar displayed as: ?
% java test2 646 646 < input
Default system encoding is 646
input encoding of 646
output encoding of 646
broken vertical bar displayed as: ?
// java file to run as a filter, converting ISO-8859-1 to UTF-8...
//modified from Java in a Nutshell v 1.1, p208
import java.io.*;
public class test2
{
public static void main(String []args) throws Exception
{
System.out.println("Default system encoding is " + System.getProperty("file.encoding"));
String inEncoding = null, outEncoding = null;
if (args.length > 0){
inEncoding = args[0];
outEncoding = args[1];
System.out.println("input encoding of " + inEncoding);
System.out.println("output encoding of " + outEncoding);
}
//InputStreamReader and friends do charset conversion
InputStreamReader in = new InputStreamReader(System.in, inEncoding);
OutputStreamWriter out = new OutputStreamWriter(System.out, outEncoding);
Reader r = new BufferedReader(in);
Writer w = new BufferedWriter(out);
char []buffer = new char[4096];
int len = 0;
while ((len = r.read(buffer)) != -1)
w.write(buffer, 0, len);
r.close();
w.flush();
w.close();
}
}
- duplicates
-
JDK-4425642 Regression: Bad conversion of bytes above 127....
-
- Closed
-