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

Eike Ziller Eike.Ziller at qt.io
Fri Nov 15 09:52:55 CET 2019



> On 15. Nov 2019, at 08:20, Thiago Macieira <thiago.macieira at intel.com> wrote:
> 
> On Thursday, 14 November 2019 13:27:23 PST André Pönitz wrote:
>> *Within* a Qt application consisting of Qt library, other libraries,
>> and actual user code it's mildly presumptous for one library to impose
>> random unnecessay restrictions on user code and other libraries.
> 
> That boat sailed 20 years ago when we started calling setlocale() from 
> QCoreapplication. We set the locale, period.
> 
> The questions are:
> 1) do we want to prevent another library from accidentally unsetting it?
> 2) do we want child processes to use the same?
> 
> Note the answers for both questions must be the same, for the solution is the 
> same. So either both yeses or both nos.
> 
>> Making assumptions on the controlability of content of a input stream is
>> questionable. The proposed method of changing the environment for child
>> processes is no guarantee on what the child actually produces, and the
>> Qt application still has to be prepared to handle non-Utf-8 or otherwise
>> "broken" input.
> 
> Qt 6 will not have support for non-UTF-8 codecs, outside of Windows. You can 
> either deal with binary data or with UTF-8 text, there's no middle ground.

- You state that as if that were a fact imposed on us from some external entity, and as if that patch were already in.
- I thought QTextCodec will still be available, even if from a separate module. If that plan has changed, provide a patch for Qt Creator as well.

> 
>> This discussion so far claimed the existance of a range of problems
>> without giving an actual example. Then it goes on to propose a shotgut
>> approach (LC_ALL, "ALL") to handle ... what? "Obscure locale settings"
>> like categories that are a bit more fine grained than LC_ALL?  Bear with
>> me when I do not have the impression that Qt will be the right context
>> to accept such "obligations".
> 
> The same argument can be made for your statements: you're arguing that here 
> are broken applications that won't handle C.UTF-8 correctly, without giving as 
> single example.
> 
> I think the whole problem is that we're trying to talk about broken 
> applications and the way their brokenness manifests itself. I don't think such 
> applications exist anymore in occurrence sufficient for us to deal with.
> 
> Anyway, since you oppose setting the environment, let's just make a check for 
> assumption:
> 
> if (locale is not UTF-8)
>    qFatal("Qt only supports UTF-8 locales. "
>           "Please configure your system properly");
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel System Software Products
> 
> 
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Erich-Thilo-Straße 10
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Development mailing list