I'm writing unit tests for a method that formats some numbers and when I use DecimalFormat("¤#,##0")
it always prefixes Â
in the unit tests. It does not display the Â
in the XML output file that the numbers are written to, but it does in the unit tests. For example:
DecimalFormat decimalFormat = new DecimalFormat("¤#,##0");
String str = decimalFormat.format(5000);
The XML output file will hold the value $5,000
, but when I debug or unit test str = "Â$5,000"
Is this expected behavior or is something wrong? The DecimalFormat
documentation (http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html) says that,
Currency sign, replaced by currency symbol. If doubled, replaced by international currency symbol. If present in a pattern, the monetary decimal separator is used instead of the decimal separator.
I understand that it is probably getting the currency symbol from the default locale, but why does the Â
show up?
If it is expected behavior great, I'll just use the replace method, but if it is not expected I want to figure out what is going on.