JDK-6547501 : There should be a space before % sign in French locale
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 5.0u11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-04-18
  • Updated: 2010-05-08
  • Resolved: 2007-06-30
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.
Other JDK 6 JDK 7
5.0u14Fixed 6u4 b01Fixed 7Fixed
Related Reports
Relates :  
Relates :  
Description
J2SE Version (please include all output from java -version flag):
V:\>java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)


Does this problem occur on J2SE 1.4.x or 5.0.x ?  
Yes (5.0.x)


Operating System Configuration Information (be specific):
Win XP Pro, Redhat5


Hardware Configuration Information (be specific):
N/A


Bug Description:
Using NumberFormat.getPercentageInstance() with a french locale will output the percentage and the %, but there is no space between them.  Our localization team indicated that, for example, "50%" should be displayed as "50 %" in french locales.


Steps to Reproduce (be specific):

(CODE)

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", "" );
        NumberFormat englishFormatter = NumberFormat.getPercentInstance(english);
        NumberFormat frenchFormatter = NumberFormat.getPercentInstance(french);
		
        if (denominator == 0) {
			System.out.println(english + ": " + englishFormatter.format(0));
			System.out.println(french + ": " + frenchFormatter.format(0));
		} else {
			System.out.println(english + ": " + englishFormatter.format(numerator/(double)denominator));
			System.out.println(french + ": " + frenchFormatter.format(numerator/(double)denominator));
		}
        
    }
}

(OUTPUT)
en_US: 50%
fr_FR: 50%

Comments
EVALUATION According to the CLDR all the french "sublocales" should use the same format of percent. Therefore fixing: j2se:src/share/classes/sun/text/resources FormatData_fr.java ------- FormatData_fr.java ------- 101c101 < "#,##0%" // percent pattern --- > "#,##0 %" // percent pattern FormatData_fr_CA.java ------- FormatData_fr_CA.java ------- 39c39 < "#,##0%" // percent pattern --- > "#,##0 %" // percent pattern FormatData_fr_CH.java ------- FormatData_fr_CH.java ------- 39c39 < "#,##0%" // percent pattern --- > "#,##0 %" // percent pattern test: j2se:test/sun/text/resources/LocaleDataTest.java j2se:test/sun/text/resources/LocaleData ------- LocaleData ------- 2213c2213,2214 < FormatData/fr/NumberPatterns/2=#,##0% --- > # changed, see bug 6547501 > FormatData/fr/NumberPatterns/2=#,##0 % 2218c2219,2220 < FormatData/fr_FR/NumberPatterns/2=#,##0% --- > # changed, see bug 6547501 > FormatData/fr_FR/NumberPatterns/2=#,##0 % 5436a5439,5466 > # bug 6547501, some of the tests might be duplicated in this datafile. > FormatData/fr/NumberPatterns/2=#,##0 % > FormatData/fr_BE/NumberPatterns/2=#,##0 % > FormatData/fr_CA/NumberPatterns/2=#,##0 % > FormatData/fr_CH/NumberPatterns/2=#,##0 % > FormatData/fr_FR/NumberPatterns/2=#,##0 % > FormatData/fr_LU/NumberPatterns/2=#,##0 %
28-05-2007

EVALUATION jiri should be able to handle this. Add a keyword ur603-l10n only for tracking, not meaning the bug should be fixed in 6u3. The detail decision will be made by Jiri.
19-04-2007