Kea
2.6.2
utf8.cc
Go to the documentation of this file.
1
// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
2
//
3
// This Source Code Form is subject to the terms of the Mozilla Public
4
// License, v. 2.0. If a copy of the MPL was not distributed with this
5
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
#include <config.h>
8
9
#include <
util/encode/utf8.h
>
10
11
namespace
isc
{
12
namespace
util
{
13
namespace
encode
{
14
15
std::vector<uint8_t>
encodeUtf8
(
const
std::string& value) {
16
std::vector<uint8_t>
result
;
17
if
(value.empty()) {
18
return
(
result
);
19
}
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) {
23
if
(ch < 0x80) {
24
result
.push_back(ch);
25
}
else
{
26
result
.push_back(0xc0 | (ch >> 6));
27
result
.push_back(0x80 | (ch & 0x3f));
28
}
29
}
30
return
(
result
);
31
}
32
33
}
// namespace encode
34
}
// namespace util
35
}
// namespace isc
result
when the call the UDPServer carries on at the same position As a result
Definition
asiodns.dox:16
isc::util::encode
Definition
encode.cc:24
isc::util::encode::encodeUtf8
std::vector< uint8_t > encodeUtf8(const std::string &value)
Encode value string into UTF-8.
Definition
utf8.cc:15
isc::util
Definition
time_utils.cc:43
isc
Defines the logger used by the top-level component of kea-lfc.
Definition
agent_parser.cc:148
utf8.h
src
lib
util
encode
utf8.cc
Generated on Wed May 7 2025 20:30:48 for Kea by
1.13.2