13 for (
const wchar_t* p = ws; *p != L
'\0'; ++p) {
14 auto cp =
static_cast<utf8proc_int32_t
>(
static_cast<uint32_t
>(*p));
16 if constexpr (
sizeof(wchar_t) == 2) {
17 if (cp >= 0xD800 && cp <= 0xDBFF && p[1] >= 0xDC00 && p[1] <= 0xDFFF) {
18 cp = 0x10000 + ((cp - 0xD800) << 10)
19 + (
static_cast<utf8proc_int32_t
>(*++p) - 0xDC00);
23 std::array<utf8proc_uint8_t, 4> bytes {};
24 const utf8proc_ssize_t
length = utf8proc_encode_char(cp, bytes.data());
29 out.append(
reinterpret_cast<const char*
>(bytes.data()),
30 static_cast<size_t>(
length));