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

With CLDR provider, NumberFormat.format could not handle locale with number extension correctly.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 13
    • 13
    • core-libs

    Description

      Test jdk: jdk13 build 10
      Run following code with CLDR provider(-Djava.locale.providers=CLDR) and default provider:
          public static void main(String[] args){
              Locale nu_arab = Locale.forLanguageTag("zh-CN-u-nu-arab");
              Locale nu_arabext = Locale.forLanguageTag("zh-CN-u-nu-arabext");
              Locale nu_th = Locale.forLanguageTag("zh-CN-u-nu-thai");
              List<Locale> localeList = List.of(nu_arab, nu_arabext, nu_th);
              for (Locale locale: localeList) {
                  System.out.println("Locale: " + locale);
                  NumberFormat nf = NumberFormat.getNumberInstance(locale);
                  System.out.println("Number: " + nf.format(-1234));
                  NumberFormat cf = NumberFormat.getCurrencyInstance(locale);
                  System.out.println("Currency: " + cf.format(-1234));
                  NumberFormat pf = NumberFormat.getPercentInstance(locale);
                  System.out.println("Percent: " + pf.format(-1234));
              }
          }
          
      Actual result:
      Run with CLDR provider(-Djava.locale.providers=CLDR):
        No minus sign before the number with locale zh-CN-u-nu-arab, zh-CN-u-nu-arabext, please refer to attached screenshot.

      Expected result:
        Should show minus sign before the number.

      Attachments

        1. Test9.java
          0.9 kB
        2. default_provider.jpg
          default_provider.jpg
          17 kB
        3. CLDR_provider.jpg
          CLDR_provider.jpg
          16 kB

        Issue Links

          Activity

            People

              naoto Naoto Sato
              dzhou Dora Zhou (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: