JDK-4060931 : JDK1.2 TextArea does not support non-English language
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.2.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.5.1
  • CPU: generic
  • Submitted: 1997-06-24
  • Updated: 1999-01-15
  • Resolved: 1999-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.2.0 1.2betaFixed
Related Reports
Relates :  
Relates :  
Description
In Japanese locale run the attached sample code, you will find the 
TextArea fails to display Japanese string, and no IM bar attached.

import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class sample {
  public static void main(String args[]) {
    new sample().run();
  }

  Frame fp;
  TextArea ta;
  TextField tf;

  void run() {
        String st = new String("����������������������������");

        fp = new Frame("Test");
        fp.setLayout(new BorderLayout());
        //fp.add("South", tf = new TextField());
        fp.add("Center", ta = new TextArea());
        ta.setText(st);
        //tf.setFont(new Font("Monospaced", Font.BOLD, 14));

    fp.pack();
    fp.show();
  }
}
~

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.2beta FIXED IN: 1.2beta INTEGRATED IN: 1.2beta
14-06-2004

SUGGESTED FIX [sherman@japan] at awtJNI_MakeFontSet() of /src/solaris/native/sun/awt/multi_font.c line 349, I found xfontset = (char *) (*env)->GetStringChars(env, xfsname, NULL); which I think is a typo, we can't assume C understand java's 2 bytes not-null-ended string, this typo causes XCreateFontSet fail to create correct XFontSet and Motif's TextArea seems not buy it, (TextField does, surprises me). Use xfontset = (char *)JNU_GetStringPlatformChars(env, xfsname, NULL); instead should solve the problem.
11-06-2004

EVALUATION Sherman's fix seems OK. I'll put it into 1.2 beta. norbert.lindenberg@Eng 1997-08-19
19-08-1997