United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4360364 Cyrillic input isn't supported under JRE 1.2.2 & 1.3 for Linux
JDK-4360364 : Cyrillic input isn't supported under JRE 1.2.2 & 1.3 for Linux

Details
Type:
Enhancement
Submit Date:
2000-08-07
Status:
Resolved
Updated Date:
2005-11-21
Project Name:
JDK
Resolved Date:
2005-06-05
Component:
client-libs
OS:
linux
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.3.0,1.4.0,1.4.1,1.4.2
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
Name: skT45625			Date: 08/07/2000


java version "1.3.0beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)


Platform: x86-architecture, Linux kernel 2.2.16 (based on RedHat 6.0 with many
updates), XFree86 3.3.5
Java: JDK 1.2.2_006 or JDK 1.3.0beta_refresh
System Enveroment:
LANG=ru
LC_ALL=ru_RU.KOI8-R
Java property:
file.encoding=KOI8-R

For cyrillic input in XFree86 used Xkb. In Xkb setted 3 keyboard layout
("US/ASCII", "KOI8-R", "Cyrillic" ). The part of file with defines of symbols
for Cyrillic 'A':
----------------- start -----------------
    key <AC04> {        [               f,               F      ],
                        [            0xc1,            0xe1      ],
                        [      Cyrillic_a,      Cyrillic_A      ]       };
-----------------  end  -----------------
For switching keyboard layouts used ISO_Group.

For test of input used this application:

----------------- start -----------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;

public class ex {
  boolean packFrame = false;

  public ex() {
    ex_frame frame = new ex_frame();
    if (packFrame) {
      frame.pack();
    }
    else {
      frame.validate();
    }
    frame.setVisible(true);
  }

  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch(Exception e) {
      e.printStackTrace();
    }

    new ex();
  }

  public class ex_frame extends JFrame {
    JPanel contentPane;
    GridLayout gridLayout1 = new GridLayout();
    JTextField jTextField1 = new JTextField();
    JButton jButton1 = new JButton();
    JTextField jTextField2 = new JTextField();

    public ex_frame() {
      enableEvents(AWTEvent.WINDOW_EVENT_MASK);
      try {
        jbInit();
      }
      catch(Exception e) {
        e.printStackTrace();
      }
    }

    private void jbInit() throws Exception  {
      gridLayout1.setRows(2);
      contentPane = (JPanel) this.getContentPane();
      contentPane.setLayout(gridLayout1);
      jTextField1.setToolTipText("input character here");
      jTextField1.setDisabledTextColor(Color.gray);
      jTextField1.setHorizontalAlignment(SwingConstants.CENTER);
      jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
  
        public void keyTyped(KeyEvent e) {
          jTextField1_keyTyped(e);
        }
      });
      jTextField2.setToolTipText("Unicode code of input character");
      jTextField2.setEditable(false);
      jTextField2.setHorizontalAlignment(SwingConstants.CENTER);
      contentPane.add(jTextField1, null);
      contentPane.add(jTextField2, null);
    }

    protected void processWindowEvent(WindowEvent e) {
      super.processWindowEvent(e);
      if (e.getID() == WindowEvent.WINDOW_CLOSING) {
        System.exit(0);
      }
    }

    void jTextField1_keyTyped(KeyEvent e) {
      jTextField2.setText( Integer.toHexString( e.getKeyChar() ) );
    }
  }

}
-----------------  end  -----------------

In upper TextField input characters, in buttom TextFiled see Unicode code of
last input character in Hex.

For key with Cyrrilic 'A' (UNICODE code - 0x0410) we see:
in JDK 1.2.2_006
layout 1: 46 (correct for all - latin F)
layout 2: e1 (correct for KOI8-R, but incorrect for UNICODE)
layout 3: 6e1 (correct for Cyrillic_A defined in X11/keysymdef.h, but incorrect
for UNICODE - 0x06xx - arabic page)

in JDK 1.3.0beta_refresh
layout 1: 46 (correct for all - latin F)
layout 2: e1 (correct for KOI8-R, but incorrect for UNICODE)
layout 3: e1 (correct for KOI8-R, but incorrect for UNICODE)

PS: sorry for bad english.
(Review ID: 108045) 
======================================================================
###@###.### 10/12/04 15:02 GMT

                                    

Comments
WORK AROUND

Workaround is to have installed more layouts(US) and to type a quote switch to US layout and than back.
###@###.### 10/12/04 15:14 GMT
                                     
2004-10-12
SUGGESTED FIX

Webrev attached.
###@###.### 2005-05-24 09:39:34 GMT
                                     
2005-05-24
EVALUATION

According to norbert.lindenberg@eng, Cyrillic input is not currently 
supported, and we currently have no plans to support it.  This could change 
if Sun decided that supporting it was important to them, as they have with 
many other writing systems in the past couple of years.  

Changing to RFE.  
eric.hawkes@eng 2001-03-15

Today I hope to put back a fix of several related problems with XAWT in the Mustang workspace. The fix is essentially a port/refactoring of XWindow.c code to XWindow.java; affected existing files will be src/solaris/native/sun/awt/awt_InputMethod.c
src/solaris/native/sun/xawt/XWindow.c
src/solaris/native/sun/xawt/XlibWrapper.c
src/solaris/classes/sun/awt/X11/XWindow.java
src/solaris/classes/sun/awt/X11/XToolkit.java
src/solaris/classes/sun/awt/X11/XMenuBarPeer.java
src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java
src/solaris/classes/sun/awt/X11/XKeySymConstants.java
src/solaris/classes/sun/awt/X11/XlibWrapper.java
make/sun/xawt/mapfile-vers
make/sun/xawt/FILES_java_unix.gmk
 -- plus some additions.

###@###.### 2005-05-17 07:12:28 GMT

If a keyboard layout properly corresponds to locale settings, a native Input Method does the job properly. However if locale is defined incorrectly - for instance, in normalized spelling - or keyboard layout does not correspond to the locale - IM may not process keysyms and pass them as is to AWT handleKeyEvent routine. It is then up to this routine to convert keysym to Unicode and post all necessary events. More often than not it did no conversion altogether. Obviously it is problem not only of Cyrillic, as you can see from the list of "See Also" bugs. In addition, with time, this native routine became too complex to maintain. In the fix provided we have added a conversion table and generally streamlined key event handling in non-IM situations.


###@###.### 2005-05-25 10:44:30 GMT
                                     
2005-05-25



Hardware and Software, Engineered to Work Together