[Development] HEADS-UP: QStringLiteral
ville.voutilainen at gmail.com
Thu Aug 22 23:43:48 CEST 2019
On Thu, 22 Aug 2019 at 15:17, 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.
You don't need to change the standard to get that, and changing the
standard doesn't give you that.
> 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.
Even that's a subset. :P I have no particular heartburn about
restricting source code to pure ascii. I, like you, am from a locale
the characters of which many many
foreign readers find seriously weird, and I have never had any trouble
with the notion of restricting source code to pure ascii. I have
always wanted to maximize
the amount of people who can read my source code, and that means
emojis are out. :)
> 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.
I must wonder.. are the benefits of that really that useful? I suppose
it's nice that you can just write utf-8 in your plain literals, but I
a u"literal" is overly burdensome.
More information about the Development