JDK-8027695 : There should be a space before % sign in Swedish locale
  • Type: Bug
  • Component: globalization
  • Sub-Component: locale-data
  • Affected Version: 7u45
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • Submitted: 2013-10-31
  • Updated: 2015-02-02
  • Resolved: 2013-11-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u80Fixed 8 b117Fixed port-stage-ppc-aixFixed
Related Reports
Duplicate :  
Relates :  
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.
Comments
Verified in b117.
28-11-2013

Will modify jdk/src/share/classes/sun/text/resources/sv/FormatData_sv_SE.java and jdk/test/sun/text/resources/LocaleData.
07-11-2013