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

Volker Hilsheimer volker.hilsheimer at qt.io
Wed Mar 22 20:48:05 CET 2023



> On 22 Mar 2023, at 18:58, Christian Ehrlicher <Ch.Ehrlicher at gmx.de> wrote:
> 
> Am 22.03.2023 um 17:35 schrieb Volker Hilsheimer via Development:
>>  But we use toLocal8Bit in plenty of cases as well. For instance in our Qt SQL APIs.
> 
> The only plugin which really uses toLocal8Bit() is the IBase - Plugin.
> Postgres is using it as fallback but according the docs the utf-8
> encoding is supported by at least PostgreSQL 7.3 so the non utf-8 part
> should be removed.
> 
> The other usages are for qWarning() output.
> 
> 
> Will take a look on the IBase stuff to see if we can replace it.

Indeed, the many hits in the sql code are mostly from warning output, thanks for checking.

But that Postgres supports UTF-8 doesn’t mean that an existing server is also configured to use it. If a server is configured to work with e.g. ISO_8859_5 encoding, because all Qt clients (which are likely middleware servers, so fully controlled) run on Windows machines with a corresponding code page, then Qt deciding to encode in UTF-8 instead will break things, won’t it? And SQL is just one example.

Even if one Qt 5 application and one Qt 6 application exchange data over a local socket, unwisely using to/fromLocal8Bit for the purpose - if the Qt 5 application continues to run with the system code page, then the Qt 6 application starting to sending UTF-8 encoded data will break this.


Volker



More information about the Development mailing list