#2335 closed defect (fixed)
Model parsing is locale dependent
Reported by: | jmichel | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | OMAR Dec 2012 |
Component: | Algorithms/Functionality | Version: | ossim/OMAR 1.8.14-3 |
Severity: | normal | Keywords: | |
Cc: |
Description
the ossimString::toDouble() method calls atof(), which depends on the current locale.
As a result, model parsing fails when using LANG="fr_FR.UTF-8" (defines floating point seperator as ',' instead of '.'), and no application based on ossim can be internationalised.
I would suggest using this trick : http://stackoverflow.com/questions/1333451/c-locale-independent-atof to implement a local independent ToDouble() method in ossimString. A useLocale flag could be used to preserve the other behaviour (though the locale independent one should be used in order to get most sensor models right without patching everywhere).
Change History (2)
comment:1 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 11 years ago
Garrett,
Just saw your patch. From the reading of stackoverflow question, the advantage of using istringstream is that you can "imbue" the stream (to force a C locale for example). I guess the code as it is now is equivalent to the previous "atof" implementation, that is, it uses the system locale.
To read data from ascii metadata in products, I guess we need to force "C" numeric locale. Also, when reading/writing ossim keywordlist, what's the intended behavior. Probably also to use "C" numeric locale.
We have adjusted the algorithm to use istringstream in the conversion. We still need to test on mingw for conversion for there is a comment about thread safety when using this approach.