diff options
Diffstat (limited to 'libs/litehtml/src/document_container.cpp')
-rw-r--r-- | libs/litehtml/src/document_container.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/libs/litehtml/src/document_container.cpp b/libs/litehtml/src/document_container.cpp index 2fb601efe4..8c3aea61bd 100644 --- a/libs/litehtml/src/document_container.cpp +++ b/libs/litehtml/src/document_container.cpp @@ -3,21 +3,19 @@ void litehtml::document_container::split_text(const char* text, const std::function<void(const char*)>& on_word, const std::function<void(const char*)>& on_space) { - std::wstring str; - std::wstring str_in = (const wchar_t*)utf8_to_wchar(text); - ucode_t c; - for (size_t i = 0; i < str_in.length(); i++) + std::u32string str; + std::u32string str_in = (const char32_t*)utf8_to_utf32(text); + for (auto c : str_in) { - c = (ucode_t)str_in[i]; if (c <= ' ' && (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f')) { if (!str.empty()) { - on_word(wchar_to_utf8(str.c_str())); + on_word(utf32_to_utf8(str)); str.clear(); } - str += (wchar_t)c; - on_space(wchar_to_utf8(str.c_str())); + str += c; + on_space(utf32_to_utf8(str)); str.clear(); } // CJK character range @@ -25,20 +23,20 @@ void litehtml::document_container::split_text(const char* text, const std::funct { if (!str.empty()) { - on_word(wchar_to_utf8(str.c_str())); + on_word(utf32_to_utf8(str)); str.clear(); } - str += (wchar_t)c; - on_word(wchar_to_utf8(str.c_str())); + str += c; + on_word(utf32_to_utf8(str)); str.clear(); } else { - str += (wchar_t)c; + str += c; } } if (!str.empty()) { - on_word(wchar_to_utf8(str.c_str())); + on_word(utf32_to_utf8(str)); } } |