Sorry, my fault with the difference in debug and release, I was compiling with multibyte on one and unicode on the other. I apologize for bothering. It seems compiling with multibyte on a german system leads to floats with 1,234 rather than 1.234 compiling as unicode. stl reference documentation indeed states, that default locale on all systems is C which is english and has 1.234 floats.
Mit freundlichen Grüßen Georg Wünsch. -------------------------------------------- Dr.-Ing. Georg Wünsch Simulation und Automatisierung machineering Pfrontener Platz 25a 80686 München Tel: 0049-89-55271364 Mail: [email protected] Web: www.machineering.de -------------------------------------------- -----Ursprüngliche Nachricht----- Von: Johannes Brunen [mailto:[email protected]] Gesendet: Freitag, 3. Juli 2009 19:09 An: [email protected] Betreff: Re: [Opensg-users] Different locale in release and debug version forscenefilehandler::write() Hello Gerrit and Georg, > > short question what is the correct setting so that floats always > go through any kind of ascii IO as 1.34234 ? I don't really want to deal > with cases where files can't be read because floats are expected to be > 1,2343 or written as 1,24143. > We use the following settings in our application: setlocale(LC_ALL, "C") setlocale(LC_CTYPE, "English") The first call sets all of the locale settings to the standard C settings => ascii IO as 1.34... The second call is for the character type. This must be localized on the customer installation language (e.g. greek). For instance setlocale(LC_CTYPE, "English") corresponds to the Englisch_USA.1252 code page. The settings of the OpenSG osginit() function is actually sensible. The problem is that the locale initialization is often performed once on application start up and this point in time maybe before the OpenSG initialization. It is really problematic that each dynamic link library is able to change the locale settings of an application which uses the library. At last, I think it is a documentation issue. It should be stated absolutly clearly that the osgInit function does change the locale settings. An application programmer then knows that he has to take action. > > And why is there a difference between Debug and Release, which seems > weird. > Ok that is a real question I can't answer. Maybe, there are more than two protagonists and it is not the blame of neither OpenSG nor the application. You can test at runtime the current locale settings by calling: char* test = setlocale(LC_ALL, NULL) The variable test contains the settings for each category separated by semicolon. With sensible distribution of such calls in the application code it should be easy to find the offender. Best, Johannes ---------------------------------------------------------------------------- -- _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users ------------------------------------------------------------------------------ _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
