ui::Utf8Decoded¶
Header: winui/core/Utf8.hpp.
One decoded code point and the number of bytes it took, as returned by decode_utf8().
Example:
const std::string text = "a\xC3\xA4"; // "a" then U+00E4
// A dump of the code points for a log, stepping by each one's length in bytes.
std::string dump;
for (std::size_t pos = 0; pos < text.size();)
{
const ui::Utf8Decoded d = ui::decode_utf8(text, pos); // length 1 for "a", 2 for U+00E4
dump += std::format("U+{:04X} ", static_cast<std::uint32_t>(d.code_point));
pos += d.length;
}
// dump == "U+0061 U+00E4 "
| Field | Type | Default | |
|---|---|---|---|
code_point |
char32_t |
0 |
the decoded code point; U+FFFD for a malformed sequence |
length |
std::size_t |
0 |
at least 1 unless pos was at the end |