[Development] RFC: Defaulting to or enforcing UTF-8 locales on Unix systems
kevin.kofler at chello.at
Sun Nov 17 13:19:27 CET 2019
Thiago Macieira wrote:
> 2) QtCore size
> As I said above, removing the legacy codecs we have code for is not a
> problem. They are already disabled in Qt builds where ICU is present, so
> we'd additionally remove them from all other builds. Where ICU is present,
> there's no loss of functionality for user applications, since ICU provides
> far more codecs than we do. For those without ICU, it stands to reason
> that the user chose size so they are aware of the limitations. Plus, one
> can always instantiate their own QTextCodec and add to the list (at least,
> with today's implementation).
Isn't ICU already a hard requirement on *nix? Since we are talking about
locales on *nix systems only, we should be able to assume a Qt build with
ICU, shouldn't we?
> Turns out, there's one locale that we can be sure that its non-UTF-8
> default is decodable under UTF-8 and that'st he "C" locale. So we don't
> *have* to qputenv "C.UTF-8" if the locale is explicitly "C" (as opposed to
> being unset).
> But I think we should.
Please be warned that C.UTF-8 is a recent introduction. (Has upstream glibc
even accepted it yet?) So setting the locale to C.UTF-8 will produce warning
spam or even fatal errors (depending on the application) on many older
distributions and possibly even on some current ones. (E.g., Fedora has
introduced this in Fedora 24 and in updates to Fedora 22 and 23. I don't
know whether this was backported to RHEL releases up to RHEL 7. RHEL 8 has
probably inherited it from recent Fedora, at least.)
More information about the Development