[Development] HEADS-UP: QStringLiteral
lars.knoll at qt.io
Thu Aug 22 14:17:23 CEST 2019
> On 21 Aug 2019, at 13:13, Ville Voutilainen <ville.voutilainen at gmail.com> wrote:
> On Wed, 21 Aug 2019 at 13:23, Lars Knoll <lars.knoll at qt.io> wrote:
>> One way would be by enforcing utf8 as source encoding for Qt based projects. It’s a huge shame that C++ doesn’t specify the encoding of source code as opposed to pretty much any other programming language (hell even JS got that one right…).
> You can ask the SG16 folks for more details, but it's waaaaayyyy too
> soon to make such a break. There are very serious users
> whose source code is EBCDIC. In a nutshell, C++ has supported multiple
> source encodings for a long time, and users rely
> on that. So sure, it's a shame, but the shame can hardly be avoided by
> anything else besides a time machine.
Transcoding source code from one encoding to another is actually pretty trivial. The current status doesn’t advocate anything, meaning you’re not even getting some slight push into this direction. Making it a compiler flag defaulting to utf8 would be step forward.
Currently it defaults to the locale encoding of your machine, a completely broken concept given that people cooperate on developing code over different machines and across countries. Worse if you have includes from different projects and both use different input encodings. There simply is no way to make this work unless you restrict yours source code to pure ascii.
In any case, we could advocate for utf8 being the input encoding when writing Qt based code/projects or even make it the default. I wanted to do that for Qt 5.0, but we couldn’t because MSVC didn’t support it at that time. It does now however.
More information about the Development