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

Minus sign for DecimalFormat is \u2212

XMLWordPrintable

    • b19
    • 11
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      In Java 1.7 and 1.8 the minug sign was - (\u002d, ascii hex 2D ), but with Java 11 and up it is \u2212.

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
                  DecimalFormat df = new DecimalFormat("#0.00");
                  Locale locale = Locale.forLanguageTag("sl-SI");
                  System.out.println("locale = " + locale);
                  DecimalFormatSymbols ddd = new DecimalFormatSymbols(locale);
                  df.setDecimalFormatSymbols(ddd);
                  String negativePrefix = df.getNegativePrefix();
                  System.out.println("minus = " + (int) negativePrefix.charAt(0));

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      locale = sl_SI
      minus = 45
      ACTUAL -
      locale = sl_SI
      minus = 8722

      CUSTOMER SUBMITTED WORKAROUND :
      Use setMinusSign on DecimalFormatSymbols.

      FREQUENCY : always


            naoto Naoto Sato
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: