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

Java numberingSystem doesn't follow CLDR defination on some locales

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 9
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      This issue exists on locale "ar-LB", "ar-MR", "uz-Cyrl", "uz-Cyrl-UZ".

      For example, output number 0.56 against ar-LB locale.
      There isn't defaultNumberingSystem property in ar_LB.xml, so as fallback definition should fallback to its parent locale ar and get the defaultNumberingSystem "arab". And then according CLDR defined number format, find the number format of ar-LB is "#٬##0٫###". And according CLDR definition of numbering system, should use Arab text to present the numeric values, since the defaultNumberingSystem is defined "arab". So the output of number 0.56 should be ٠٫٥٦ on ar-LB locale, but actually Java's output is 0,56.
      Please use below code to get java's output.
      ---------------------------------------------------------
      String tag ="ar-LB";
      Locale target = Locale.forLanguageTag(tag);
      double d = Double.valueOf("0.56").doubleValue();
      String outString = NumberFormat.getInstance(target).format(d);
      System.out.println(outString);
      ----------------------------------------------------------

        Attachments

          Activity

            People

            • Assignee:
              naoto Naoto Sato
              Reporter:
              yzhou Daisy Zhou
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: