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

With CLDR provider, DecimalFormatSymbols.getInstance(locale) could not handle locale with nu extension correctly.

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:

      Description

      Sample code snippet:
      public static void main(String[] args){
              List<String> langList = new ArrayList<String>();
              langList.add("de-DE");
              langList.add("de-DE-u-nu-deva");
              for(String langTag: langList) {
                  Locale locale = Locale.forLanguageTag(langTag);
                  DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale);
                  Character decimal = Character.valueOf(dfs.getDecimalSeparator());
                  Character group = Character.valueOf(dfs.getGroupingSeparator());
                  System.out.println("locale: " + langTag + " decimal: [" + decimal + "] group: [" + group + "]");
              }
          }

      For de-DE-u-nu-deva, there is no number system defined for "deva" in de-DE and de, my understanding is it should fallback to 'latn' in de, and have the same output with de-DE, but it seems not.
      Locale de-DE-u-nu-deva is an example, it also failed on other locales when number system specified by 'nu' does not exist in the corresponding CLDR xml.

      CLDR spec:
      <symbols numberSystem="deva">
                  <alias source="locale" path="../symbols[@numberSystem='latn']"/>
      </symbols>
      de.xml:
      <symbols numberSystem="latn">
      <decimal>,</decimal>
      <group>.</group>
                              ...
      </symbols>

      Expected:
      locale: de-DE decimal: [,] group: [.]
      locale: de-DE-u-nu-deva decimal: [,] group: [.]

      Output:
      locale: de-DE decimal: [,] group: [.]
      locale: de-DE-u-nu-deva decimal: [.] group: [,]

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: