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

Kevin Kofler kevin.kofler at chello.at
Sat Nov 2 18:16:36 CET 2019

Thiago Macieira wrote:
> Is your shell configured for German or for English? Try setting your
> locale to German and then see how long it will take for you to have to
> override when posting a question or an answer.

Unlike you, to get messages in English for human reading, I have been using 
en_US.UTF-8 rather than C for years (long before C.UTF-8 became a thing) 
exactly because of that.

> Except for the LC_ALL=C case for overriding the user's locale so that one
> can get messages and formatting in machine-parseable format. The normal
> case and this one probably account for over 99% of all scenarios.

For machine readability, there is probably a reason for picking C rather 
than en_US.UTF-8 or even C.UTF-8, e.g., to get ASCII quotes rather than the 
fancy Unicode quotes used under en_US.UTF-8.

>> > How about making the resetting opt-out, instead of opt-in?
>> I was more thinking of a runtime option. Like
>>   QCoreApplication::setPropagateOurChoices(true)
> I think a runtime option like that belongs in QProcessEnvironment.

A true runtime option actually belongs in an environment variable, not in a 
method that has to be called by the compiled code. (In fact, that's what I 
would have expected your proposed QT_NO_OVERRIDE_LC_CTYPE to be, but 
apparently you were thinking of a preprocessor define.)

Whether to propagate the locale to child processes is really a decision that 
can and should be left to the user at runtime rather than compiling it 
either into the application (as in André's proposal) or even into Qt itself 
(as in your proposal).

        Kevin Kofler

More information about the Development mailing list