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

different currency symbols in ja_JP (Japanese-Japan) localization

XMLWordPrintable

    • 1.1.6
    • sparc
    • solaris_2.5.1
    • Verified



        Name: laC46010 Date: 10/19/97



        Methods NumberFormat.getCurrencyInstance creates wrong format for ja_JP
        (Japanese-Japan) localization.
        This format returns the pattern "¥#,##0" instead of "\u5186#,##0".
                                         ^----\u00a5

        As result JDK1.2 fails to pass the following JCK1.2 test case:

        api/java_util/localeData/coreLocale.html#ja_JP

        The contradiction comes from the source where
        "yen" character is used in "currency pattern" but
        "\u5186" is used as a "local currency symbol".
        In all others locales identical characters are used
        in these places.

        See src/share/classes/java/text/resources/LocaleElements_ja.java

                "¥#,##0", /*currency pattern*/
        ...
                ",", /*group (thousands) separator*/
        ...
                "0", /*native 0 digit*/
                "#", /*pattern digit*/
                "-", /*minus sign*/
                "E", /*exponential*/
                "\u5186", /*local currency symbol*/
        ...
                ".", /*monetary decimal separator*/

         
        An example below produces the following output:
        --------------output----------------
        failed: return: ¥#,##0 instead \u5186#,##0

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

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

        if ( df.toLocalizedPattern().equals("\u5186#,##0")) {
        System.out.println("OK");
        } else {
        System.out.println("failed: return: "+
        df.toLocalizedPattern() + " instead " +
        "\\u5186#,##0");
        }
            }
        }

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

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

              rgillamsunw Richard Gillam (Inactive)
              leosunw Leo Leo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: