fix utf-8 decoder & add u32string functions

This commit is contained in:
MihailRis
2024-08-29 15:40:51 +03:00
parent 5045ffb923
commit 96941cb707
3 changed files with 60 additions and 22 deletions
+7
View File
@@ -8,3 +8,10 @@ TEST(stringutil, crop_utf8) {
str = str.substr(0, util::crop_utf8(str, 7));
EXPECT_EQ(str, u8"при");
}
TEST(stringutil, utf8) {
std::string str = u8"テキストデモ";
auto u32str = util::str2u32str_utf8(str);
std::string str2 = util::u32str2str_utf8(u32str);
EXPECT_EQ(str, str2);
}