[Development] HEADS-UP: QStringLiteral

Kevin Kofler kevin.kofler at chello.at
Thu Aug 22 14:59:55 CEST 2019

Mutz, Marc via Development wrote:
> For me, the problem is QUtf8XXX::size() - what should that return?!

IMHO, obviously the number of bytes. You can have additional O(N) 
numCodePoints() and (if needed) utf16Size() (which takes needed surrogate 
pairs into account) methods, but the inherent size is the number of bytes.

> IOW: what's the meaning of an index into a UTF-8 string? That extends to
> mid(), left(), right(), split(), ...

IMHO, a byte index, and if that chops the codepoint, so be it, same as for 
the surrogate pairs in the UTF-16 QString. Anything else is just not doable 
with reasonable efficiency.

        Kevin Kofler

More information about the Development mailing list