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

Unicode chars in Window title display incorrectly when changing Locales

    Details

    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      windows_nt

      Description


      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 ---------

        Attachments

          Activity

            People

            • Assignee:
              yan Yuri Nesterenko
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: