-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
tiger
-
sparc
-
solaris_2.6
-
Verified
Name: aaC67449 Date: 02/08/2000
HTMLEditorKit does not parse TAGs in Cp037 character encoding
See example which tries to display ./index.html using Cp037
It displays plain text only
#> java -Dfile.encoding=Cp037 TestWWW
#> java TestWWW # this displays correct html
------------------------- example ----------------
import java.util.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.io.*;
public class TestWWW {
public static void main(String argv[]) {
JFrame f=new JFrame();
try {
final JEditorPane ep=new JEditorPane();
try {
ep.setPage("file:index.html");
} catch(FileNotFoundException e) {}
ep.addMouseListener(new HTMLEditorKit.LinkController());
ep.setEditable(false);
ep.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e){
try {
if(e.getEventType().equals(HyperlinkEvent
.EventType.ACTIVATED)) {
System.out.println("URL:"
+e.getURL());
ep.setPage(e.getURL());
}
} catch(Exception ex) {
ex.printStackTrace();
}
}
});
final JTextField ur=new JTextField("file:index.html",80);
ur.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
ep.setPage(ur.getText());
} catch(Exception ex) {
ex.printStackTrace();
}
}
});
JScrollPane panel=new JScrollPane(ep);
f.getContentPane().add(ur,"North");
f.getContentPane().add(panel);
f.setSize(300,300);
f.setVisible(true);
ep.isVisible();
} catch(Exception e) {
e.printStackTrace();
}
}
}
------------------------- index.html ----------------
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<H1>H1 test</H1>
<P>
<A HREF="index.html">
HREF test</A>
</P>
</BODY>
</HTML>
======================================================================
- relates to
-
JDK-4495331 Swing and swing demos should not use default version of InputStreamReader()
- Resolved
-
JDK-4256423 default encoding in String(byte[]) doesn't match file.encoding
- Closed