reading doubles is locale specific
Brought to you by:
leethomason
When reading a double value then the expected decimal separator is locale-dependant. Normally the decimal separator is well-defined in XML documents though, so I suggest to always use '.' instead. When using STL then this can easily be accomplished by using std::stringstream instead of scanf.
I acknowledge the flaw, but how is the non-STL mode handled? And can scanf be run in a non-local mode? (Or do we need to rewrite scanf?)
Setting to 'pending' for ideas or feedback.
Maybe it's enough to temporarily switch the locale to "C", and resetting it afterwards.
Also, glib has g_ascii_strtod: http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-ascii-strtod. If licences are compatible you could perhaps copy+paste that function from glib.
In the Medical Imaging Interaction Toolkt we fixed this issue like this, maybe you could use the patch:
http://mitk.org/git/?p=MITK.git;a=commitdiff;h=092876e873b300719048492d43e48fd6af157bf7;hp=ce8329ae5717ec6cb319b65ead6006f137aeaa31