JDK-6502834 : Bidi Mirrored Characters (e.g., parenthesis) Display Reversed: Regression fm 1.3
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.4.2_13,5.0u10
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1,windows_2000
  • CPU: generic,sparc
  • Submitted: 2006-12-11
  • Updated: 2010-04-04
  • Resolved: 2007-04-04
Related Reports
Duplicate :  
Description
In the upgrade from the 1.3.1.XX Java Plug-in (JPI) to 1.5.0_XX, our customer found that the Hebrew bidirectional (flipping) behavior of parenthesis, braces, brackets and other Unicode identified mirroring characters. That is, a string in Hebrew with 1.3.1.XX would have looked like (3)WERBEH and now looks like )3(WERBEH. To reproduce the problem:

1) Set Control Panel | Regional and Language Options | Standards and Formats of the Regional Options tab to Hebrew.
2) Run the following applet with JPI 1.5.0_09:

import java.awt.ComponentOrientation;

import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import java.awt.BorderLayout;
import java.awt.GridLayout;

public class RTLSun extends JApplet
{ 
  public void init()
  {
    JLabel jl1 = new JLabel("RTL JLabel with BDO");
    jl1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JLabel jl1w = new JLabel("\u202d\u05e2\u05d1\u05e8\u05d9\u05ea(5)");
    jl1w.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JLabel jl2 = new JLabel("RTL JLabel without BDO");
    jl2.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JLabel jl2wo = new JLabel("\u05e2\u05d1\u05e8\u05d9\u05ea(5)");
    jl2wo.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JPanel jp1 = new JPanel(new GridLayout(4,1));
    jp1.add(jl1);
    jp1.add(jl1w);
    jp1.add(jl2);
    jp1.add(jl2wo);

    JLabel jl3 = new JLabel("RTL JTextField with BDO");
    jl3.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JTextField jtfw = new JTextField("\u202d\u05e2\u05d1\u05e8\u05d9\u05ea(5)");
    jtfw.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JLabel jl4 = new JLabel("RTL JTextField without BDO");
    jl4.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JTextField jtfwo = new JTextField("\u05e2\u05d1\u05e8\u05d9\u05ea(5)");
    jtfwo.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JPanel jp2 = new JPanel(new GridLayout(4,1));
    jp2.add(jl3);
    jp2.add(jtfw);
    jp2.add(jl4);
    jp2.add(jtfwo);


    getContentPane().add(jp1, BorderLayout.NORTH);
    getContentPane().add(jp2, BorderLayout.SOUTH);

    setVisible(true);
  }
}

Note that the behavior regresses only with the inclusion of the Left-to_right Override (BDO) Unicode Character (U+202D). Note also that the problem does not reproduce with Arabic instead of Hebrew. Lastly, note that this bug no longer reproduces with Java SE 6 RC, though it consistently reproduces with 1.4.2_12 and 1.5.0_10.

Comments
EVALUATION Fixed in CR # 6449486 ( 1.5 update 11 )
04-04-2007