Details
-
Suggestion
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.14.2
-
None
Description
QString already has support for back and forth conversions between QString and std::u16string and std::u32string, but not std::u8string. I know UTF8 is already available through QString::fromUtf8()/toUtf8(), but the std::u8string overloads could be added for consistency (and convenience).
Also, in addition to support std::basic_string<> from/to conversions, it could be nice to have std::basic_string_view<> based overloads when available (including the char8_t, char16_t and char32_t versions).
Having the string-view overloads would allow neat constructs like adding custom string literals operators that create QStrings from utf8/16/32 string literals etc etc.
I'm sure a lot of people need to inject or extract std::basic_string<> into Qt at some point, and having all the required conversions built into QString would offer a simple and convenient entry point for that. Especially now we have an almost-decent encoding support in std::basic_string<> that wouldn't break QString better defined requirements and behaviors regarding string encoding.
Sorry if this has already been requested or acknowledged, or if I'm simply missing something, I couldn't find any mention of this.