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

[Fmt-De] Czech locales DecimalFormat grouping separator set to ascii code 160

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6u10
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      build 1.6.0_10-b33

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP Professional Version 5.1.2600 Service Pack 3 Build 2600

      A DESCRIPTION OF THE PROBLEM :
      Czech locales DecimalFormat grouping separator is set to ascii code 160 instead of 32 or something else reasonable.
      As an effect such formatted number cannot be parsed back.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      99(char 32)000
      ACTUAL -
      99(char 160)000

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Locale;
      import java.text.DecimalFormat;
      import java.text.NumberFormat;
      import java.math.BigDecimal;

      public class DecimalFormatTest {
      public static void main(String[] args) {
      Locale loc = new Locale("cs", "cz");
      DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(loc);
      String str = df.format(new BigDecimal("99000"));
      System.out.println(str.indexOf(160) >= 0? "failed": "OK");
                      // or format.parse(str) fails
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
      dfs.setGroupingSeparator(' ');
      df.setDecimalFormatSymbols(dfs);

            peytoia Yuka Kamiya (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: