10-03-2011 03:48 PM
I recently received feedback from some users of my program that NaN shows up where all the numbers should be. My data comes from a webservice that returns xml formatted to en_US. I then parse the data and construct HTML which is shown in the QNXWebStageView. Things work great when the device is set to en_US, but if someone has their settings to something like fr_FR, this is where the trouble begins.
I can't even get simple code such as this to work:
var frCurrencyFormatter:CurrencyFormatter = new CurrencyFormatter("fr_FR");
var valuetring = frCurrencyFormatter.format(7);
This ends up printing NaN as opposed to 7.
Note: this works fine when the simulator is set to US English, but returns NaN when set to a different culture such as fr_FR.
As a .Net developer, this really frustrates me coming to a language like this where things I take for granted never seem to work without a few headaches.
Any help would be greatly appreciated!
10-03-2011 05:44 PM
10-04-2011 12:39 PM
Unfortunately neither "fr", "FR", "fr_FR" nor "fr-FR" work.
Doesn't look like the NumberFormatter works either.
Curiously, the reverse function works: parseNumber works as expected.
I guess for the time being I'll release a version which will convert any NaN numbers and use toString() instead, so my international users will have to suffer with values like 7 instead of 7.00.
I suppose later with some time I'll write my own version of format which works correctly, wish I didn't have to do all this though.
Thanks for the help
If anyone else has run into anything similar to this and has a solution, I'm open to ideas.