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

Locale.getDisplayScript() (no args) does not honor default DISPLAY locale

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b04
    • CPU:
      generic
    • OS:
      generic

      Description

      The code snippet below illustrates the issue.

      Locale loc = Locale.forLanguageTag("zh-Hans-CN");

      // Set default locale to en-US
      Locale.setDefault(Locale.US);

      System.out.println("Default Locale: en-US");
      System.out.println(" langauge: " + loc.getDisplayLanguage());
      System.out.println(" script: " + loc.getDisplayScript());

      // Set DISPLAY locale to zh-Hans-CN
      Locale.setDefault(Category.DISPLAY, loc);

      System.out.println("Default DISPLAY Locale: zh-Hans-CN");
      System.out.println(" langauge: " + loc.getDisplayLanguage());
      System.out.println(" script: " + loc.getDisplayScript());

      // Set default locale to zh-Hans-CN
      Locale.setDefault(loc);

      System.out.println("Default Locale: zh-Hans-CN");
      System.out.println(" langauge: " + loc.getDisplayLanguage());
      System.out.println(" script: " + loc.getDisplayScript());

      This code prints out -

      Default Locale: en-US
      langauge: Chinese
      script: Simplified Han
      Default DISPLAY Locale: zh-Hans-CN
      langauge: ¿¿
      script: Simplified Han
      Default Locale: zh-Hans-CN
      langauge: ¿¿
      script: ¿¿¿¿

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              naoto Naoto Sato
              Reporter:
              naoto Naoto Sato
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: