[Development] Qt6: Adding UTF-8 storage support to QString
jhihn at gmx.com
Wed Jan 16 20:06:24 CET 2019
> Sent: Tuesday, January 15, 2019 at 4:44 PM
> From: "Allan Sandfeld Jensen" <kde at carewolf.com>
> To: development at qt-project.org
> Subject: Re: [Development] Qt6: Adding UTF-8 storage support to QString
> On Dienstag, 15. Januar 2019 19:43:57 CET Cristian Adam wrote:
> > Hi,
> > With every Qt release we see how the new release improved over previous
> > releases in terms of speed, memory consumption, etc.
> > Any chance of having UTF-8 storage support for QString?
> Use QByteArray when you can.
And *I* do. (Not the OP). But I would love a QByteArray that matches QString's API. I wrote this email, then was going about gathering evidence to make my case about why QByteArray was inadequate. It seems many of my complaints with using QByteArray over the years have been addressed unbeknownst to me, though one glaring omission remains:
- QByteArray lacks QString's arg() support. The QString("%1").arg(X) combination is pretty readable, and reliable, and maintainable.
I don't know how the average Qt user stacks up, but I only use QStrings in UIs (because I have to), the rest (which is a lot) is all QByteArray. When I'm using QString not in a UI, it's normally ending with toUtf8().
I don't really care utf8 vs 16, vs whatever (slight bias for utf8 as it looks better in hex editors), I just hate that I have to deal with character width issue this concretely by having to code against one of two very similar but not equivalent classes.
More information about the Development