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

1.1.2 Cannot display/input Japanese text in TextField and TextArea

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1
    • None
    • 1.1.2
    • client-libs
    • generic
    • solaris_2.5

    Description

      With 1.1.2, display and input of Japanese text in TextField and TextArea
      is broken. This used to work in 1.1 and 1.1.1.

      Same problem happens when running in the zh_TW locale, i.e.,
      display and input of Chinese charactors is broken in TextField and TextArea.

      The following problem shows the problem.

      import java.io.*;
      import java.awt.*;
      import java.awt.event.*;

      public class TextAreaBug extends java.applet.Applet implements TextListener {
          Frame frame;
          TextArea ta;
          String data = null;

          public static void main(String args[]) {
      String string;

      if (args.length == 0) {
      System.out.println("usage: java TextAreaBug filename");
      return;
      }

      try {
      FileReader reader = new FileReader(args[0]);
      char buf[] = new char[1000];
      int len;

      len = reader.read(buf, 0, buf.length);
      string = new String(buf);
      } catch (Exception e) {
      e.printStackTrace();
      return;
      }

      Frame f = new Frame("TextArea test");
      TextAreaBug clnt = new TextAreaBug(string);
      clnt.init();
      clnt.start();

      f.add("Center", clnt);
      f.resize(500, 300);
      f.pack();
      f.show();
          }

          public TextAreaBug(String string)
          {
      data = string;
          }

          public void init() {

      ta = new TextArea("Test", 5, 20, TextArea.SCROLLBARS_NONE);
      ta.setText(data);
      add(ta);

      ta.addTextListener(this);
          }
          
          public void textValueChanged(TextEvent e) {
      TextArea textArea = (TextArea)e.getSource();
      int id = e.getID();

              System.out.println("textValueChanged called");
      if (id == TextEvent.TEXT_VALUE_CHANGED)
      System.out.println("\tevent ID is TEXT_VALUE_CHANGED");
      else
      System.out.println("\tevent ID is: " + id);
      System.out.println("TextArea string: " + textArea.getText());
          }
      }


      Sample data:
      abc
      \044\065\044\067\044\137
      bye

      Attachments

        Issue Links

          Activity

            People

              apalanissunw Anand Palaniswamy (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: