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

DecimalSymbols group separator for Locale de_CH changed from Java 10 to Java 11

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      The group separator for language format German, region Switzerland (de_CH) changed from Java 10 to Java 11.
      In 10, it was correctly a ' (ASCII 39), in Java 11 it prints a ’ (ASCII 8217?) instead. This is wrong, ASCII 39 was the correct character. Was this change intentional?

      REGRESSION : Last worked in version 10.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile attached source code, run once on Java 11 and one on Java 10.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Thousands separator is ' ASCII code 39. Currency format: 1'234.56
      ACTUAL -
      Thousands separator is ASCII code 8217. Currency format: 1’234.56

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

      public class SwissCurrencyFormatTest {
        public static void main( String[] args ) {
          DecimalFormat formatter = ( DecimalFormat) NumberFormat.getInstance( new Locale( "de", "CH" ) );
          formatter.applyPattern( "###,###.##" );
          char separator = formatter.getDecimalFormatSymbols().getGroupingSeparator();
          System.out.println( "Thousands separator is " + separator + " ASCII code " + ( int) separator + ". Currency format: " + formatter.format( 1234.56 ) );
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      formatter.getDecimalFormatSymbols().setGroupingSeparator('\'');

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: