add adapter.

This commit is contained in:
amass 2024-06-19 23:16:48 +08:00
parent 32c2c860d9
commit bb351137cb
2 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,7 @@
#include <string>
#include <string_view>
#include <cstdint>
class SecureHashAlgorithmPrivate;

View File

@ -97,6 +97,7 @@ slow:
}
std::string UTF8ToGBK(const std::string &utf8Str) {
#ifdef WIN32
int wideStrLen = MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), -1, NULL, 0);
if (wideStrLen == 0) {
return "";
@ -112,8 +113,11 @@ std::string UTF8ToGBK(const std::string &utf8Str) {
std::string gbkStr(gbkStrLen, 0);
WideCharToMultiByte(CP_ACP, 0, wideStr.c_str(), -1, &gbkStr[0], gbkStrLen, NULL, NULL);
return gbkStr;
#else
assert(false && "not implement.");
return "";
#endif
}
} // namespace StringUtility