Skip to content

Commit

Permalink
Merge branch 'dev/2.0.0' of github.com:dvorka/mindforger into dev/2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dvorka committed Feb 4, 2024
2 parents aa5d859 + f6057a1 commit 0e1e92e
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions lib/src/gear/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,53 +49,6 @@ char** stringSplit(const char* s, const char delimiter);
char** stringSplit(const char* s, const char delimiter, u_int16_t resultBaseSize, u_int16_t resultIncSize);
std::vector<std::string> stringSplit(const std::string s, const std::string regexDelimiter);

#if defined(_WIN32)
static inline std::string stringToUtf8(std::string& codepage_str)
{
int size = MultiByteToWideChar(
CP_ACP, MB_COMPOSITE,
codepage_str.c_str(),
codepage_str.length(),
nullptr,
0);

std::wstring utf16_str(size, '\0');
MultiByteToWideChar(
CP_ACP,
MB_COMPOSITE,
codepage_str.c_str(),
codepage_str.length(),
&utf16_str[0],
size);

int utf8_size = WideCharToMultiByte(
CP_UTF8,
0,
utf16_str.c_str(),
utf16_str.length(),
nullptr,
0,
nullptr,
nullptr);
std::string utf8_str(utf8_size, '\0');
WideCharToMultiByte(
CP_UTF8,
0, utf16_str.c_str(),
utf16_str.length(),
&utf8_str[0],
utf8_size,
nullptr,
nullptr);

return utf8_str;
}
#elif defined(__APPLE__)
static inline std::string stringToUtf8(std::string& codepage_str)
{
return codepage_str;
}
#endif

/**
* @brief Normalizes a string to NCName.
*
Expand Down

0 comments on commit 0e1e92e

Please sign in to comment.