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
+12 -2
View File
@@ -23,11 +23,21 @@ namespace util {
/// @return new UTF-8 encoded string
std::string wstr2str_utf8(const std::wstring& ws);
/// @brief Decode UTF
/// @brief Decode UTF-8 string
/// @param s source encoded string
/// @return new raw decoded string
/// @return new raw decoded wstring
std::wstring str2wstr_utf8(const std::string& s);
/// @brief Encode raw u32string to UTF-8
/// @param ws source raw wstring
/// @return new UTF-8 encoded string
std::string u32str2str_utf8(const std::u32string& ws);
/// @brief Decode UTF-8 string
/// @param s source encoded string
/// @return new raw decoded u32string
std::u32string str2u32str_utf8(const std::string& s);
/// @brief Calculated length of UTF-8 encoded string that fits into maxSize
/// @param s source UTF-8 encoded string view
/// @param maxSize max encoded string length after crop