Hi all,
As a user, I am happy with simplifications regarding string handling and I
think the choice of utf16 for QString makes sense for most code except for
file/networking code.
I was once concerned about not being able to distinguish between QByteArray
containing utf8 text and QByteArray containing other data. But now, I am
using the following pattern to distinguish between both in the *very rare
places* where I need to have a different overload for each, or want to
provide a separate type with strong guarantees about a QByteArray content:
struct Utf8 { QByteArray utf8; }
This pattern obviously works for "tagging" any kind of data. See
https://www.fluentcpp.com/2018/04/06/strong-types-by-struct/ for a
presentation of this pattern.
Regarding the relevance of a QUtf8String, I feel like it would not be so
useful unless it allows to view its content as QChar instead of char (or
char8_t) since handling multibyte characters is so error prone. At least a
QChar handles most unicode characters as single entities...
Cheers,
Arnaud
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development