On Wed, Jun 11, 2014 at 08:56:38AM -0400, Richard Heck wrote: > On 06/11/2014 05:04 AM, Enrico Forestieri wrote: > > > >meaning that we rely upon something that indirectly sets the locale for us. > >I think that the right fix is the attached one. After applying it, > >QLocale::system() returns the right thing from the beginning. > > To be honest, I am not terribly well informed about this sort of > topic, so I am more than happy to take your word for what is right > here.
I have checked that it is Qt itself that calls setlocale(LC_ALL, "") during QCoreApplication initialization. Of course, that is never performed for batch processing and this explains the bug. I have also verified that it is not necessary to call setlocale() on Windows (and in the Qt sources the call is #ifdef'd out by the guard Q_OS_UNIX), so a better place for the call is os::init(). I am going to commit a patch to both master and stable. -- Enrico