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

Decimal form is inconsistent between CLDR and Java in some special locales

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 10
    • 9
    • core-libs
    • b12
    • Verified

      Steps:
      Tests number format consistency between CLDR and Java, using 0.56 as input.
      For example: on locale pt_PT. The pattern of decimalFormat is "#.##0,###" (group is "." and decimal is ",") in CLDR pt.xml file.
      To compare the output format between CLDR and Java, by running below code.

      public void javaNumberOutput() {
          String a="0.56";
          Locale target = Locale.forLanguageTag("pt-PT");

          double d = Double.valueOf(a).doubleValue();
          String outString = NumberFormat.getNumberInstance(target).format(d);
          System.out.println("expected:" + outString);
      }

      Result:
      Following CLDR decimalFormat, the output should be 0,56, but actually the output of below code is 0$56.

            rgoel Rachna Goel (Inactive)
            yzhou Daisy Zhou (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: