Am Mittwoch, 11. Juni 2014 schrieb Enrico Forestieri: > commit 82faa6619239c2e57fba9128899bafe29d728e51 > Author: Enrico Forestieri <for...@lyx.org> > Date: Wed Jun 11 18:23:44 2014 +0200 > > Set the default locale at startup. > > On startup, the default locale is "C", meaning that all system > functions assume an ascii codeset. The environment's locale > settings should be selected by calling setlocale(LC_ALL,""). > This is done by Qt during the QCoreApplication initialization > but this inizialization is never performed for batch processing > and, as a result, LyX is not able to process files whose names > contain non-ascii characters. This is not an issue on Windows, > where the file names are always stored as UTF-16, so the call is > only performed for unix-like platforms (this also includes cygwin, > due to its own filenames management that allows using characters > which are forbidden to native programs). > > diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp > index 92cbf15..4179d49 100644 > --- a/src/support/os_cygwin.cpp > +++ b/src/support/os_cygwin.cpp > @@ -215,6 +215,9 @@ void init(int argc, char * argv[]) > argc_ = argc; > argv_ = argv; > > + // Set environment's default locale > + setlocale(LC_ALL, ""); > + > // Make sure that the TEMP variable is set > // and sync the Windows environment. > setenv("TEMP", "/tmp", false); > diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp > index b85bdb2..03dfb38 100644 > --- a/src/support/os_unix.cpp > +++ b/src/support/os_unix.cpp > @@ -46,6 +46,9 @@ void init(int argc, char * argv[]) > { > argc_ = argc; > argv_ = argv; > + > + // Set environment's default locale > + setlocale(LC_ALL, ""); > }
This breaks the tex2lyx tests with a german locale, probably since support::convert<double>(std::string const s) wants now a comma instead of a period as decimal point, so the string "0.3359375" gets now converted to 0 instead of 0.3359375. Other conversions are probably broken as well, and unfortunately this is also in 2.1.1. The question is: Do we need two versions of support::convert() (one taking the current locale into account for user inout/output, and one always using the "C" locale for internal conversions), or was the old behaviour correct? Georg