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

decimal separator instead of currency decimal separator

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: laC46010 Date: 10/19/97



      Decimal separator and monetary decimal separator differ for certain locales.
      However NumberFormat.getCurrencyInstance() produces format that uses
      decimal separator instead of monetary decimal separator.
      As result JDK1.2 fails to pass the following JCK1.2 test cases:

      api/java_util/localeData/secondaryLocale.html#de_CH
      api/java_util/localeData/secondaryLocale.html#pt_PT

      See example for de_CH(German-Swtzerland) localization below.
      --------------output----------------
      failed: return: Fr. #'##0,00;Fr.-#'##0,00 instead Fr. #'##0.00;Fr.-#'##0.00

      --------------DE_CH_fails.java--------------------
      import java.util.Locale;
      import java.text.NumberFormat;
      import java.text.DecimalFormat;

      class DE_CH_fails {
          public static void main(String argv[]) {
      Locale de = new Locale("de", "CH");
      NumberFormat nf = NumberFormat.getCurrencyInstance(de);
      DecimalFormat df = (DecimalFormat)nf;

      if ( df.toLocalizedPattern().equals("Fr. #'##0.00;Fr.-#'##0.00")) {
      System.out.println("OK");
      } else {
      System.out.println("failed: return: "+
      df.toLocalizedPattern() + " instead " +
      "Fr. #'##0.00;Fr.-#'##0.00");
      }
          }
      }

      ---------------------------------------------------------

      ======================================================================

            joconnersunw John Oconner (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: