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

There should be a space before % sign in Swedish locale

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 7u45
    • globalization

    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 :
      Use the source code pasted below

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected: 50 %
      ACTUAL -
      Actual: 50%


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.NumberFormat;
      import java.util.Locale;

      public class SwedishLocale {

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

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

              NumberFormat englishFormatter = NumberFormat.getPercentInstance(english);
              NumberFormat swedishFormatter = NumberFormat.getPercentInstance(swedish);
                      
              if (denominator == 0) {
                  System.out.println(english + ": " + englishFormatter.format(0));
                  System.out.println(swedish + ": " + swedishFormatter.format(0));
              } else {
                  System.out.println(english + ": " + englishFormatter.format(numerator/(double)denominator));
                  System.out.println(swedish + ": " + swedishFormatter.format(numerator/(double)denominator));
              }
          }
      }
      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

              mfang Michael Fang (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: