[Development] RFC: Defaulting to or enforcing UTF-8 locales on Unix systems

Edward Welbourne edward.welbourne at qt.io
Mon Nov 4 18:29:41 CET 2019

On Monday, 4 November 2019 01:40:00 PST Edward Welbourne wrote:
>> * a list of regexes for program names to which it applies, when started
>>   as child processes.
>> Or is that too hard to implement at all the places where we call exec()
>> and its equivalents ?

Thiago Macieira (4 November 2019 15:48)
> That's not at all what I wanted.
> I want to do qputenv in the Qt application *itself*, inside QCoreApplication.
> Note the most important process that this will apply to: itself. It applies to
> all other frameworks inside the same application that may inspect the
> environment, including an extra unknown call to setlocale(LC_ALL, "").

... and we can do that just fine if we
* record the prior value we're over-riding on some master object,
  that also remembers the list of regexes;
* call qputenv() exactly as you have in mind;
* when about to start a sub-process, ask that master object if the
  command name matches one of its regexes;
* if it does, restore *for only it* (e.g. after fork()) the prior value.

The default for everything else is then to see an environment with our
"correction" applied to the locale env var(s).


More information about the Development mailing list