Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4152211

JEditorPane or HTMLEditorKit should be aware of HTML charactor encoding

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2fcs
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description

      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]

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              busersunw Btplusnull User (Inactive)
              Reporter:
              ktakahassunw Koushi Takahashi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: