Problem with NumberFormat.getCurrencyInstance(LocFR)

I am trying to perform this operations:

import java.text.NumberFormat;

import java.util.Locale;

publicclass BadLocale{

privatestatic Locale LocFR =new Locale("fr");

privatestatic NumberFormat nf = NumberFormat.getCurrencyInstance(LocFR);

/** Creates a new instance of BadLocale */

public BadLocale(){

}

publicstaticvoid main(String[] args){

String cost ="123456.78";//I get Number from DB as String it looks like this way

//really, cost value comes to class as Object instance

String res= nf.format(Float.parseFloat(cost.toString().trim()));

System.out.println("source value = " +cost);

System.out.println("formatted value = " + res);

}//main

}//class

I get:

source value = 123456.78

formatted value = 123 456,78 ?/b>

What does symbol "?" means?

How can I put It away without additional parsing method?

That's terrible.

I can't produce automatic document creation.

Please, help me

Message was edited by:

Holod

[1943 byte] By [Holoda] at [2007-11-27 3:39:11]
# 1
It possibly means you don't have a glyph for the euro character in the font being used for display.
sabre150a at 2007-7-12 8:42:32 > top of Java-index,Core,Core APIs...
# 2
Thank you.I understand, that this symbol signifies euro/dollar/frank e.t.c.Is there any possibility to put away such "sign" of money?I do not need it.Russian Ruble (I am form Russian Federation) doesn't have any symbol, but we use French NumberFromat.
Holoda at 2007-7-12 8:42:32 > top of Java-index,Core,Core APIs...
# 3
What does you code give if you change to use Russia as the locale?
sabre150a at 2007-7-12 8:42:32 > top of Java-index,Core,Core APIs...
# 4

I just ran into the same problem, and the solution is obvious once you see it! Currency is country specific, not language specific. You (and I) created the Locale as "new Locale("fr")", which constructs a Locale object with the French language, but which country is it? French is an official language in Canada (as well as other countries), which uses '$' as the currency symbol. In France, they use '€'. If you use Locale.FRANCE then the numbers are formatted correctly for Russia, unfortunately the currency symbol will be wrong. If you create your locale object as new Locale("RU", "RU") then the currency will be displayed as: 12 345,67 руб.

I think this is what you want.

scirkaa at 2007-7-12 8:42:32 > top of Java-index,Core,Core APIs...