I am facing problem while opening a downloaded CSV file in Excel under window 7 for above locale. Sometime the number is treated as date and all the cells are misaligned and formatted incorrectly.
I have written code for CSV download with the localized format. It's working perfectly for all the regions except this one.
I invested the issue and it came to know that there is a mismatch between format defined on Windows 7 system and locale retrieved from ServletRequest#getLocale() for Norwegian, Bokmal(Norway).
Here is my code:
Servlet:
Locale locale = request.getLocale();
DecimalFormat decimalFormatter=(DecimalFormat)DecimalFormat.getInstance(locale);
locale.getDisplayCountry(); // empty string
decimalFormatter.toLocalizedPattern(); // #,##0.###
locale.getDisplayLanguage(); // Norwegian Bokmål
locale.toString(); // nb
Now look at the Digit grouping symbol and Decimal symbol in above code.
My Question: How can I get the correct number format pattern as it is on Windows 7?
Here is the screenshot of the Languages set in Firefox.
Here is the screenshot of Language and Region on Windows 7 where for numbers Digit grouping symbol is a single space and Decimal symbol is a comma.