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

Thiago Macieira thiago.macieira at intel.com
Mon Nov 4 19:46:20 CET 2019

On Monday, 4 November 2019 09:29:41 PST Edward Welbourne wrote:
> On Monday, 4 November 2019 01:40:00 PST Edward Welbourne wrote:
> > 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.

That only applies to QProcess. It will not apply to third-party components 
that fork helper processes.

It's possible atfork() could do this, but I'm not sure. it won't catch all of 
them, especially those that prepare the environment before forking (like 
execve / execle's caller).

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products

More information about the Development mailing list