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

decimal display for lang es and country us is not the expected us display

XMLWordPrintable

      FULL PRODUCT VERSION :
      jdk 1.4.2
      jdk 1.5.10
      jdk 1.6.2

      ADDITIONAL OS VERSION INFORMATION :
      I have tested this on:
      windows xp
      windows vista
      mac osx
      mac g4
      ubuntu 3

      A DESCRIPTION OF THE PROBLEM :
      the decimal and thousands separator are reversed from what they are supposed to be.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      create new Locale("es", "US") and then format any number.
      compare to new Locale("es_US") and new Locale("en_US") as well as new Locale("es_ES") or new Locale("es_MX")

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      2,000.00

      ACTUAL -
      2.000,00

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.java.test;

      import java.text.NumberFormat;
      import java.util.ArrayList;
      import java.util.List;
      import java.util.Locale;

      public class LangTest {
          private static final List<Locale> lst = new ArrayList<Locale>();

          static {
              lst.add(new Locale("es", "US"));
              lst.add(new Locale("es_US"));
              lst.add(new Locale("en", "US"));
              lst.add(new Locale("en_US"));
              lst.add(new Locale("es", "ES"));
              lst.add(new Locale("es_ES"));
              lst.add(new Locale("es"));
              lst.add(new Locale("en"));
          }

          public static void main(String[] args) {
              for (Locale locale :lst) {
                  processLocale(locale);
              }
          }

          private static void processLocale(Locale locale) {
              NumberFormat nf = NumberFormat.getInstance(locale);

              System.out.println(locale + " " + nf.format(29.99));
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      new Locale("es_US")

            asaha Abhijit Saha
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: