The reason that this might not work for you, is usage of invalid white space character.
The format class expect the char with code 160 witch is describe as "Non-breaking space", when you may pass the code 30 witch is "Space".
You can run this code to check it.
NumberFormat currencyInstance = NumberFormat.getCurrencyInstance(Locale.FRANCE);
String france = "1 599,99 €";
String format = currencyInstance.format(1599.99);
Number number = currencyInstance.parse(format);
System.out.println("France: " + format);
System.out.println("Format: " + format);
System.out.println("Number: " + number);
if(france.equals(format)) {
number = currencyInstance.parse(france); // Must work;
System.out.println(number);
} else {
char[] fr = france.toCharArray();
char[] ft = format.toCharArray();
for(int i = 0; i < fr.length; i++) {
if(fr[i] != ft[i]) {
System.out.printf("The value on position %d are not equal. France: %d; Format: %d", i,(int)fr[i], (int)ft[i]);
}
}
}
Then environment details:
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
OS: Windows 7 64-bits.
NOTE:
As @Black Panter added this is known bug
JDK-4510618 : [Fmt-Nu] French thousands separator is non-breaking space
WORK AROUND
(1) Remove user's grouping separator (i.e. U+0020) in a String to be parsed.
(2) Replace user's grouping separator with the formatter's grouping seperator (U+00A0) if it's inconvenient to remove all spaces.