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

Unicode chars in Window title display incorrectly when changing Locales

XMLWordPrintable

    • Fix Understood
    • x86
    • windows_nt


      A Java application has a title that contains Greek Unicode characters represented by the byte values "\u0391\u0392\u0393\u0394\u0395\u0396". When this application is run on a system with the Default system Locale set to "Greek" and the font used for the Active Title Bar set to Lucida sans Unicode, the title displays correctly. If the default system Locale is changed to another Locale (say UK English), the title is displayed as "??G??".

      The following tests demonstrate the difference between Java and Native apps.

      Test 1. With the default System Locale set to Greek. Create a text file saved with a name that has the same Greek characters in the title. Swap Locales. Open the document in WordPad and the title bar displays the document name correctly regardless of the Locale.
      Test 2. With the default System Locale set to Greek. Create a directory with a name that contains the same greek characters and open that directory in Windows Explorer. The title bar of Explorer displays the name correctly regardless of Locale.

      The following Test Case follows the problem description above. If run with the default Syatem Locale set to "Greek", it works fine. If the Locale is set to something other than "Greek" the title displays as "??G??"

      --------- cut here ---------

      import javax.swing.*;
      import java.awt.*;

      public class TitleTest extends JFrame
      {
          public static void main(String[]args)
          {

              TitleTest f = new TitleTest();
              f.setSize(300,200);
              String str = ("\u0391\u0392\u0393\u0394\u0395\u0396");
              f.setTitle(str);
              JLabel label = new JLabel(str);
              System.out.println(str);
              
              f.getContentPane().add(label);
              f.setVisible(true);
          }

      }

      --------- cut here ---------

            yan Yuri Nesterenko
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: