-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
tiger
-
sparc
-
solaris_2.5
Name: dsC58869 Date: 12/12/99
The method
public void javax.swing.text.rtf.RTFEditorKit.write(OutputStream out,
Document doc, int pos, int len)
throws wrong IOException for Cp037 character encoding.
Here is a minimized test:
import javax.swing.text.*;
import javax.swing.text.rtf.*;
import java.io.*;
public class RTFEditorKitTest01 {
public static void main (String args[]) {
RTFEditorKit kit = new RTFEditorKit();
Document doc = kit.createDefaultDocument();
String test = "";
try {
ByteArrayOutputStream sw=new ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(sw);
System.out.println(osw.getEncoding());
kit.write(sw,doc,0,0);
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (BadLocationException ble) {
ble.printStackTrace();
}
}
}
--- Output: ---
%echo $LANG
C
%java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-Q)
Java HotSpot(TM) Client VM (build 1.3-P, interpreted mode)
%java -Dfile.encoding=Cp037 RTFEditorKitTest01
????????@??@?????§????K??K???????????z@??????????@?????@??@?????????@???@????§^E??@?????K?????K????K???K?????????K???????????M?????????K????z???]§^E??@?????K?????K????K???K?????????K???????????????M?????????K????z???]§^E??@?????K?????K????K???K????????????K???????????????????????M????????????K????z???]§^E??@?????K?????K????K???K????????????K??????????????M????????????K????z???]§^E??@?????K?????K????K???K????????????K?????????????M????????????K????z???]§^E??@?????K?????K????K???K????????????K?????M????????????K????z???]§^E??@??????????????????K????M??????????????????K????z??]§
%
It means (converted from Cp037 to ASCII):
Encoding is Cp037
java.io.IOException: Unexpected token in character set file
at javax.swing.text.rtf.RTFReader.readCharset(RTFReader.java:590)
at javax.swing.text.rtf.RTFReader.getCharacterSet(RTFReader.java:556)
at javax.swing.text.rtf.RTFGenerator.outputConversionForName(RTFGenerator.java:972)
at javax.swing.text.rtf.RTFGenerator.writeRTFHeader(RTFGenerator.java:310)
at javax.swing.text.rtf.RTFGenerator.writeDocument(RTFGenerator.java:115)
at javax.swing.text.rtf.RTFEditorKit.write(RTFEditorKit.java:105)
at RTFEditorKitTest01.main(RTFEditorKitTest01.java:18)
======================================================================
###@###.### 2004-09-23
The method
public void javax.swing.text.rtf.RTFEditorKit.write(OutputStream out,
Document doc, int pos, int len)
throws wrong IOException for Cp037 character encoding.
Here is a minimized test:
import javax.swing.text.*;
import javax.swing.text.rtf.*;
import java.io.*;
public class RTFEditorKitTest01 {
public static void main (String args[]) {
RTFEditorKit kit = new RTFEditorKit();
Document doc = kit.createDefaultDocument();
String test = "";
try {
ByteArrayOutputStream sw=new ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(sw);
System.out.println(osw.getEncoding());
kit.write(sw,doc,0,0);
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (BadLocationException ble) {
ble.printStackTrace();
}
}
}
--- Output: ---
%echo $LANG
C
%java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-Q)
Java HotSpot(TM) Client VM (build 1.3-P, interpreted mode)
%java -Dfile.encoding=Cp037 RTFEditorKitTest01
????????@??@?????§????K??K???????????z@??????????@?????@??@?????????@???@????§^E??@?????K?????K????K???K?????????K???????????M?????????K????z???]§^E??@?????K?????K????K???K?????????K???????????????M?????????K????z???]§^E??@?????K?????K????K???K????????????K???????????????????????M????????????K????z???]§^E??@?????K?????K????K???K????????????K??????????????M????????????K????z???]§^E??@?????K?????K????K???K????????????K?????????????M????????????K????z???]§^E??@?????K?????K????K???K????????????K?????M????????????K????z???]§^E??@??????????????????K????M??????????????????K????z??]§
%
It means (converted from Cp037 to ASCII):
Encoding is Cp037
java.io.IOException: Unexpected token in character set file
at javax.swing.text.rtf.RTFReader.readCharset(RTFReader.java:590)
at javax.swing.text.rtf.RTFReader.getCharacterSet(RTFReader.java:556)
at javax.swing.text.rtf.RTFGenerator.outputConversionForName(RTFGenerator.java:972)
at javax.swing.text.rtf.RTFGenerator.writeRTFHeader(RTFGenerator.java:310)
at javax.swing.text.rtf.RTFGenerator.writeDocument(RTFGenerator.java:115)
at javax.swing.text.rtf.RTFEditorKit.write(RTFEditorKit.java:105)
at RTFEditorKitTest01.main(RTFEditorKitTest01.java:18)
======================================================================
###@###.### 2004-09-23