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

[Fmt-Nu] Formatting of percents incorrect for some locales

    Details

    • Subcomponent:
    • Resolved In Build:
      b12
    • CPU:
      generic, x86
    • OS:
      generic, windows_vista

      Backports

        Description

        Name: ddT132432 Date: 08/21/2001


        java version "1.4.0-internal"
        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-B)
        Java HotSpot(TM) Client VM (build 1.3.0-B, mixed mode)

        (The following information comes from IBM NLDG.)

        The most common symbol used to indicate percent is %, as in 37%.
        Brazil, Iceland, Israel, South Africa, and Switzerland prefer no space between
        the number and the symbol, as follows: 37%.
        The Dutch language as used in Belgium and the Netherlands sometimes uses pct
        (as in 37 pct) to represent percentages.
        In the Canadian province of Qu?bec, the number and symbol is written as 37 %,
        with a space in between.
        In Turkey, the percent symbol is written before the number: %37.
        In some countries using Arabic script, 37 % may also be written using arabic
        characters for the percent and numerals, e.g. \u066a\u0663\u0667

        However, both JDK 1.3 and JDK1.4 beta return the same text for all supported
        locales. For example, the following code returns '12%' regardless of locale.

        ----- PercentTest.java -----

        import java.text.*;
        import java.util.*;

        public class PercentTest {
            public static void main(String[] args) {
        Locale locale[] = NumberFormat.getAvailableLocales();
        for (int i = 0; i < locale.length; i++) {
                    System.out.println(locale[i].toString()+"("+locale[i].getDisplayCountry()+")"+"-->"+NumberFormat.getPercentInstance(locale[i]).format(0.1234));
        }
            }
        }

        ----- end -----
        (Review ID: 130424)
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jtusla Jiri Tusla (Inactive)
                  Reporter:
                  ddressersunw Daniel Dresser (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: