15std::vector<uint8_t>
encodeUtf8(
const std::string& value) {
16 std::vector<uint8_t> result;
20 const uint8_t* start =
reinterpret_cast<const uint8_t*
>(value.c_str());
21 std::vector<uint8_t> binary(start, start + value.size());
22 for (uint8_t ch : binary) {
26 result.push_back(0xc0 | (ch >> 6));
27 result.push_back(0x80 | (ch & 0x3f));