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

There should be a space before % sign in Swedish locale

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7u45
    • Fix Version/s: 8
    • Component/s: globalization
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b117
    • OS:
      windows_7
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.7.0_45"
        Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
        Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        A DESCRIPTION OF THE PROBLEM :
        The formatting of percents in the Swedish sv_SE locale is incorrect. There should be a space between the number and the percentage symbol.

        Actual: 50%
        Expected: 50 %

        A similar Java bug was fixed for France: bug id 6547501

        According to the Swedish Language Council, the percent sign should be preceded by a space in Swedish. ( http://en.wikipedia.org/wiki/Percent_sign )

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        import java.text.NumberFormat;
        import java.util.Locale;

        public class TestLocale {

        public static void main( String argv[] ) {
                int numerator = 1;
            int denominator = 2;

            Locale english = new Locale( "EN", "US", "" );
                Locale french = new Locale( "FR", "FR", "" );
                Locale swedish = new Locale( "SV", "SE", "" );

                NumberFormat englishFormatter = NumberFormat.getPercentInstance(english);
                NumberFormat swedishFormatter = NumberFormat.getPercentInstance(swedish);
                NumberFormat frenchFormatter = NumberFormat.getPercentInstance(french);

                if (denominator == 0) {
                    System.out.println(english + ": " + englishFormatter.format(0));
                    System.out.println(french + ": " + frenchFormatter.format(0));
                    System.out.println(swedish + ": " + swedishFormatter.format(0));
                } else {
                    System.out.println(english + ": " + englishFormatter.format(numerator/(double)denominator));
                    System.out.println(french + ": " + frenchFormatter.format(numerator/(double)denominator));
                    System.out.println(swedish + ": " + swedishFormatter.format(numerator/(double)denominator));
                }
            }
        }

        Output:
        en_US: 50%
        fr_FR: 50 %
        sv_SE: 50%

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        sv_SE: 50 %

        (see the space between the number and % symbol)
        ACTUAL -
        sv_SE: 50%

        No space

        REPRODUCIBILITY :
        This bug can be reproduced always.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  yhuang Yong Huang (Inactive)
                  Reporter:
                  peytoia Yuka Kamiya (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: