JDK-5014911 : b32c, b40, b42 input Arabic and Hebrew charaters fail in JTextComponents
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,linux_redhat_9.0
  • CPU: x86
  • Submitted: 2004-03-17
  • Updated: 2005-06-07
  • Resolved: 2005-06-07
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.
JDK 6
6 b40Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Locale: ar_SA, he_IL, en_US
Regression: Yes
Build: b32c, b40, b42
Inputing Arabic and Hebrew (RTL) characters in JTextField, JTextArea and JTextPane fails. Input characters are not displayed in the JTextComponent. Only latin characters and numbers can be input in the JTextComponents. This bug occurs only under Redhat9.

To reproduce bug
1. Log into a Redhat9 machine
2. choose KDE windows manager
3. Verify you have Arabic and Hebrew keyboard mapping, so you can type Arabic and hebrew characters
4. Compile and run the following testcase "jTextComponent.java"
5. In the JtextField, type some English characters
6. Verify that English characters are input and displayed in the JTextField
7. Switch Language to Arabic
8. Type some Arabic characters
9. Note that Arabic characters are not displayed in the JTextField
10. Repeat above steps for the JTextArea and JTextpane 
11. Switch Language to Hebrew
12. Type some Hebrew characters
13. Note that Hebrew characters are not displayed in the JTextComponents

-------------jTextComponent.java------------------------
/* Copyright (c) Sun Microsystems 1999

$Header: /home-bazelet/sun/src/javaLab/JDK1.4/standard/jTextComponent.java,v 1.1.1.1 2001/06/19 15:01:31 isam Exp $

*/

import java.awt.*;
import java.awt.font.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.text.*;

public class jTextComponent extends JApplet
{
  public void init()
  { 
    jTextComponent1 jTextComponent2 = new jTextComponent1();
    getContentPane().add(jTextComponent2);
  }

  public static void main(String[] args)
  {
    JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
    frame.setContentPane(new jTextComponent1());
    frame.pack();
    frame.setVisible(true);
        frame.addWindowListener( new WindowAdapter()
        {
             public void windowClosing( WindowEvent e)
             {
                 System.exit(0);
             }
        });

  }
}
class jTextComponent1 extends JPanel
{
  public jTextComponent1()
  {
    JLabel l;
    JPanel p;
    JTextField field;
    JTextArea area;
    JTextPane pane;
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));

    p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    l = new JLabel("JTF1, implicit, left");
    l.setVerticalAlignment(SwingConstants.BOTTOM);
    l.setFont(new Font("Lucida Sans Regular",Font.PLAIN,10));
    field = new JTextField(15);
    field.setFont(new Font("Lucida Sans Regular",Font.PLAIN,10));
    field.setText("\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
    p.add(l);
    p.add(field);
    p.setPreferredSize(new Dimension(175,60));
    panel.add(p);


    p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    l = new JLabel("JTA2, explicit RTL, left");
    l.setVerticalAlignment(SwingConstants.BOTTOM);
    l.setFont(new Font("Lucida Sans Regular",Font.PLAIN,10));
    area = new JTextArea();
    area.setPreferredSize(new Dimension(180,250));
    area.setLineWrap(true);
    area.setText("\u0053\u0074\u0061\u0072\u0074\u0020\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
    p.add(l);
    p.add(area);
    p.setPreferredSize(new Dimension(175,110));
    panel.add(p);


    p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    l = new JLabel("JTP1 implicit, left");
    pane = new JTextPane();
    pane.setFont(new Font("Lucida Sans Regular",Font.PLAIN,10));
    l.setVerticalAlignment(SwingConstants.BOTTOM);
    l.setFont(new Font("Lucida Sans Regular",Font.PLAIN,10));
    pane.setPreferredSize(new Dimension(180,250));
    pane.setText("\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
    p.add(l);
    p.add(pane);
    p.setPreferredSize(new Dimension(175,160));
    panel.add(p);


    panel.setPreferredSize(new Dimension(300,1900));

    JScrollPane scroll = new JScrollPane(panel);
    scroll.setPreferredSize(new Dimension(210,450));

    add(scroll);
  }
}

Comments
EVALUATION Name: sh120115 Date: 03/17/2004 This sounds pretty serious. ###@###.### 2004-03-17 ====================================================================== Per ###@###.### this looks like an i18n bug. ###@###.### 2004-03-18 In this case, KeyPress/KeyRelease X events are generated with keysyms over 256. For example, if the Arabic layout is selected and the user presses 'a' key, it generates KeyPress/KeyRelease with keysym=Arabic_sheen(0x5d4). handleKeyEvent in XWindow.c simply ignores such key events because keysymToAWTKeyCode returns keycode==java_awt_event_KeyEvent_VK_UNDEFINED. Probably, we need to implement what the comment suggests as follows: /* Rather than returning, which might filter characters such as a-grave (?), * perhaps we should have a table based on keysymdef.h. We could * include only unicode chars (thus removing arrows, modifiers, etc.) * and use it in keySymToUnicodeChar. It would replace the * mapsToUnicodeChar part of the keymap table entirely. * The difference is that the new table would convert keysyms to * unicode characters, while the current table converts them to keycodes. */ ###@###.### 2004-03-19 Name: ynR10250 Date: 03/22/2004 It seems to be the same bug as 4960727 (with Russian xkb keymap). In 496072, there are suggestions by ###@###.### about fix. I'm not ready to close this bug as a duplicate, though; committing to dragonfly. ###@###.### After fix to 4360364, XAWT version should work properly in Mustang. ====================================================================== ###@###.### 2005-05-25 10:13:07 GMT
25-05-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
02-09-2004