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

Thai and Burmese characters not displayed correctly on Mac OS X

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.12.5

      A DESCRIPTION OF THE PROBLEM :
      Java applications on Mac OS X don't compose Thai and Burmese characters correctly. Rather than being composed into one character they are shown as the base character plus a dotted circle with an accent. The system fonts to show those characters correctly are available because they are shown as expected in a window title bar or in a terminal window.

      For example THAI CHARACTER WO WAEN (U+0E27) followed by THAI CHARACTER MAI HAN-AKAT (U+0E31) should be combined into a single glyph. Likewise MYANMAR LETTER NNYA (U+100A) followed by MYANMAR SIGN ASAT (U+103A).

      This means potential users of our software in Thailand, Vietnam, Burma, etc. are unable to use the software because things like filenames or text that they enter isn't displayed correctly.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the attached test program from a Terminal window and observe the console output, window title bar and window contents.

      > javac Test.java
      > java Test

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The same foreign characters should appear in the window title, in each of the three labels and text fields in the window, and in the console output.
      ACTUAL -
      The window title bar and console output show the correct characters but the contents of the window incorrectly show the decomposed character sequence.

      Selecting ArialUnicodeMS as the font changes the situation slightly (the 3rd text field now composes the Thai characters) but doesn't work for all characters, plus users might want to use a different font, and therefore this isn't a viable solution.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;

      public class Test
      {
          public static final String TEXT = "\u100a\u103a \u0e27\u0e31";

          public static void main(String[] args)
          {
              System.out.println(System.getProperty("java.vm.name")+" "+System.getProperty("java.version"));
              System.out.println(System.getProperty("os.name")+" "+System.getProperty("os.version")+" "+System.getProperty("os.arch"));
              System.out.println("TEXT is "+TEXT);
              JFrame f = new JFrame("Title "+TEXT);
              JLabel label = new JLabel("Label "+TEXT);
              JTextField text = new JTextField("Text "+TEXT);
              text.setEditable(false);
              JTextField text2 = new JTextField("Text "+TEXT);
              text2.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
              text2.setEditable(false);

              f.getContentPane().setLayout(new FlowLayout());
              f.getContentPane().add(label);
              f.getContentPane().add(text);
              f.getContentPane().add(text2);
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.pack();
              f.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

      SUPPORT :
      YES

        Attachments

        1. 8u131-test.png
          8u131-test.png
          13 kB
        2. 9-test.png
          9-test.png
          9 kB
        3. Test.java
          1 kB

          Issue Links

            Activity

              People

              Assignee:
              scfitch Stephen Fitch
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: