-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.2
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.4.2_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-b05)
Java HotSpot(TM) Client VM (build 1.4.2_09-b05, mixed mode)
1.4.2_11
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
1- Method 1
- Load an arabic file in 420
- The string contain garbage
2- Method 2
-Create a string in unicode format
-Store the string in codepage 420 (cp420)
-the string stored is not all 420 (some characters are stored as 3F)
i downloaded the latest version 1.4.2_11 and the problem still persist. Please run the sample code i wrote in the save dialog and use a codepage 420 and using a hex editor you will find that some characters are saved as 0x3F
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
-Load a string in arabic unicode (FE range or 06 Range)
-Save the File in codepage (cp420)
-Load the file again in codepage(cp420)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
-The arabic string is readable
ACTUAL -
-The arabic string contain garbage letters and some are able to be reproduced correctly
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//Loading module:
try {
FileDialog fileDlg = new FileDialog(mainGuiInstance, "Load", FileDialog.LOAD);
fileDlg.show();
String filePath = fileDlg.getDirectory() + fileDlg.getFile();
Reader fr = new InputStreamReader(new FileInputStream(filePath),codepage);
BufferedReader br = new BufferedReader(fr);
String line = null;
StringBuffer sb = new StringBuffer();
while ((line = br.readLine())!=null ) {
sb.append(line).append("\n");
}
fr.close();
getTextInput().setText(sb.toString());
} catch (Exception exp) {
exp.printStackTrace();
}
//Saving Module:
try {
FileDialog fileDlg = new FileDialog(mainGuiInstance, "Save", FileDialog.SAVE);
fileDlg.show();
String filePath = fileDlg.getDirectory() + fileDlg.getFile();
Writer fw = new OutputStreamWriter(new FileOutputStream(filePath),codepage);
String str = getTextOutput().getText();
fw.write(str);
fw.close();
} catch (Exception exp) {
exp.printStackTrace();
}
//Codepage variable:
//codepage reproducing this bug is CP420
//Also try other values
//CP864
//CP1046
//CP1089
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
1) use the IBM JRE 1.4.1 which store with the correct codepage
2) use IBM Rational application developer
java version "1.4.2_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-b05)
Java HotSpot(TM) Client VM (build 1.4.2_09-b05, mixed mode)
1.4.2_11
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
1- Method 1
- Load an arabic file in 420
- The string contain garbage
2- Method 2
-Create a string in unicode format
-Store the string in codepage 420 (cp420)
-the string stored is not all 420 (some characters are stored as 3F)
i downloaded the latest version 1.4.2_11 and the problem still persist. Please run the sample code i wrote in the save dialog and use a codepage 420 and using a hex editor you will find that some characters are saved as 0x3F
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
-Load a string in arabic unicode (FE range or 06 Range)
-Save the File in codepage (cp420)
-Load the file again in codepage(cp420)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
-The arabic string is readable
ACTUAL -
-The arabic string contain garbage letters and some are able to be reproduced correctly
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//Loading module:
try {
FileDialog fileDlg = new FileDialog(mainGuiInstance, "Load", FileDialog.LOAD);
fileDlg.show();
String filePath = fileDlg.getDirectory() + fileDlg.getFile();
Reader fr = new InputStreamReader(new FileInputStream(filePath),codepage);
BufferedReader br = new BufferedReader(fr);
String line = null;
StringBuffer sb = new StringBuffer();
while ((line = br.readLine())!=null ) {
sb.append(line).append("\n");
}
fr.close();
getTextInput().setText(sb.toString());
} catch (Exception exp) {
exp.printStackTrace();
}
//Saving Module:
try {
FileDialog fileDlg = new FileDialog(mainGuiInstance, "Save", FileDialog.SAVE);
fileDlg.show();
String filePath = fileDlg.getDirectory() + fileDlg.getFile();
Writer fw = new OutputStreamWriter(new FileOutputStream(filePath),codepage);
String str = getTextOutput().getText();
fw.write(str);
fw.close();
} catch (Exception exp) {
exp.printStackTrace();
}
//Codepage variable:
//codepage reproducing this bug is CP420
//Also try other values
//CP864
//CP1046
//CP1089
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
1) use the IBM JRE 1.4.1 which store with the correct codepage
2) use IBM Rational application developer
- duplicates
-
JDK-4116222 Errors in Arabic code-conversion tables, part II
-
- Resolved
-