[Development] Qt6: Adding UTF-8 storage support to QString
thiago.macieira at intel.com
Fri Jan 25 21:29:06 CET 2019
On Friday, 25 January 2019 08:54:38 PST Konstantin Tokarev wrote:
> > How often do you need that, oustide of QString itself? And maybe a few
> > efficient QtCore classes? (QCborValue comes to mind)
> Each time I need to interact efficiently with extenal code which isn't
> Qt-based, e.g. WebKit, ICU. In particular, this extra copy would certainly
> degrade performance of QtWebKit.
> Oh and you've mentioned CBOR, this implies that it won't be possible for Qt
> users to make efficient implementation of a different serialization format.
I didn't say we shouldn't have it. I was just trying to gather information
about the need.
So it looks like we do need it, if we ever change the encoding. My worry is
that people will fail to handle the combinations properly. Which is why I
dislike different encodings even more than changing it wholesale with an API-
However, one of my pending Qt 6 changes is to store a flag in QString that
says "this UTF-16 string is known to contain only US-ASCII characters". That
way, toUtf8() can use the faster toLatin1() algorithm (the flag is set by
toUtf8() and toLatin1() the first time they're called). The problem is that it
needs to clear that flag in all detach() calls.
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development