-
Bug
-
Resolution: Fixed
-
P2
-
1.2.0
-
1.2fcs
-
generic
-
generic
-
Not verified
JEditorPane and/or HTMLEditorKit should be aware of HTML charactor encoding. Right now on 1.2 Beta4 "J", JEditorPane reads raw HTML file. It does not any character-set conversion when reading HTML. Try following program with Japanese HTML. I attached Japanese HTML file, encoded JIS.
$ java TestEditorPane index_ja.html Serif
-----
/*
* %W% %E% koushi
*/
import com.sun.java.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.net.*;
public class TestEditorPane extends JFrame {
public static void main(String[] args) {
if(args.length != 2) {
System.out.println("Usage: java TestEditorPane <html_file> <font>");
System.exit(1);
}
new TestEditorPane(args);
}
TestEditorPane(String[] args) {
super("JEditorPane");
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
try {
URL url = new URL("file:" + args[0]);
JEditorPane html = new JEditorPane(url);
html.setEditable(false);
Font f = new Font(args[1], Font.PLAIN, 12);
html.setFont(f);
JScrollPane scroll = new JScrollPane(html);
getContentPane().add(scroll);
} catch (Exception e) {
System.out.println(e);
System.exit(1);
}
setSize(500,300);
//pack();
show();
}
}
-----
[koushi.takahashi@japan 1998-06-25]
$ java TestEditorPane index_ja.html Serif
-----
/*
* %W% %E% koushi
*/
import com.sun.java.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.net.*;
public class TestEditorPane extends JFrame {
public static void main(String[] args) {
if(args.length != 2) {
System.out.println("Usage: java TestEditorPane <html_file> <font>");
System.exit(1);
}
new TestEditorPane(args);
}
TestEditorPane(String[] args) {
super("JEditorPane");
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
try {
URL url = new URL("file:" + args[0]);
JEditorPane html = new JEditorPane(url);
html.setEditable(false);
Font f = new Font(args[1], Font.PLAIN, 12);
html.setFont(f);
JScrollPane scroll = new JScrollPane(html);
getContentPane().add(scroll);
} catch (Exception e) {
System.out.println(e);
System.exit(1);
}
setSize(500,300);
//pack();
show();
}
}
-----
[koushi.takahashi@japan 1998-06-25]
- relates to
-
JDK-4117014 JEditorPane cannot read Japanese HTML, TokenMgrError.
- Closed