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%