27 #include <string_view>
34 desc.reserve(desc.size() + s.size());
36 unsigned ch = i.strict_deref();
37 if ((ch & 0x80000000) == 0 && ch >=
' ' && ch !=
'\\' && ch != 127) {
40 desc.append(
"\\x", 2);
41 desc +=
"0123456789abcdef"[(ch >> 4) & 0x0f];
42 desc +=
"0123456789abcdef"[ch & 0x0f];
An iterator which returns Unicode character values from a UTF-8 encoded string.
void description_append(std::string &desc, std::string_view s)
Append a string to an object description, escaping invalid UTF-8.
void append_utf8(std::string &s, unsigned ch)
Append the UTF-8 representation of a single Unicode character to a std::string.
Unicode and UTF-8 related classes and functions.