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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 13
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:

      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. CLDR_provider.jpg
          CLDR_provider.jpg
          16 kB
        2. default_provider.jpg
          default_provider.jpg
          17 kB
        3. Test9.java
          0.9 kB

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                dzhou Dora Zhou
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: