[Development] Qt6: Adding UTF-8 storage support to QString
arnaud.clere at minmaxmedical.com
Mon Jan 21 15:51:03 CET 2019
> -----Original Message-----
> From: Allan Sandfeld Jensen <kde at carewolf.com>
> On Dienstag, 15. Januar 2019 19:43:57 CET Cristian Adam wrote:
> > Any chance of having UTF-8 storage support for QString?
> Use QByteArray when you can.
I think a QUtf8String class derived from QByteArray would help a lot making this happen in the real world!
1. It would be found more easily by users in need of a utf8 encoded dynamic string
2. It would allow making the encoding explicit (QString or QUtf8String or QLatin1String) in newer Qt APIs or user-defined ones, and even totally safe if disabling const char * casts is possible
3. It would allow adding QString-like APIs (like setNum(), simplified(), etc.) over the time without cluttering QByteArray
Moreover, I have a specific use-case where QByteArray args are used as binary data (say CBOR) and a specific Utf8String is useful to handle utf8 encoded args without always encoding/decoding to utf16.
I might not be the only one...
More information about the Development