Localization problem with human readable file formats (obj, ply, ... )
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Loading and writing of human readable file formats fails if a localisation for a program is used, which changes the representation of float values.
Bugreport is created after a discussion on the user mailing list:
http://www.vtk.org/pipermail/vtkusers/2012-February/121416.html
The reader/writer classes e.g. "vtkOBJReader"
are using sscanf for reading float values from the files. Problem is:
- the obj standard describes the use of '.' float values like "1.7"
- if a program changes the localisation to a form which uses e.g. ',' as a float decimal seperator like "1,7", the Reader and Writer classes are not able to load obj files anymore.
Since the Reader/Writer have to verify that it is always reading the standard float values, i suggest the use of
sscanf_l() and sprintf_l() calls (which should be supported by various plattforms.
A different apporoach would be saveing the global localisation, set it for the time of reading to the compatible mode "c" and then set it back to the former values. But this would be a hack.