add adapter.
This commit is contained in:
parent
32c2c860d9
commit
bb351137cb
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
class SecureHashAlgorithmPrivate;
|
class SecureHashAlgorithmPrivate;
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ slow:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string UTF8ToGBK(const std::string &utf8Str) {
|
std::string UTF8ToGBK(const std::string &utf8Str) {
|
||||||
|
#ifdef WIN32
|
||||||
int wideStrLen = MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), -1, NULL, 0);
|
int wideStrLen = MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), -1, NULL, 0);
|
||||||
if (wideStrLen == 0) {
|
if (wideStrLen == 0) {
|
||||||
return "";
|
return "";
|
||||||
@ -112,8 +113,11 @@ std::string UTF8ToGBK(const std::string &utf8Str) {
|
|||||||
|
|
||||||
std::string gbkStr(gbkStrLen, 0);
|
std::string gbkStr(gbkStrLen, 0);
|
||||||
WideCharToMultiByte(CP_ACP, 0, wideStr.c_str(), -1, &gbkStr[0], gbkStrLen, NULL, NULL);
|
WideCharToMultiByte(CP_ACP, 0, wideStr.c_str(), -1, &gbkStr[0], gbkStrLen, NULL, NULL);
|
||||||
|
|
||||||
return gbkStr;
|
return gbkStr;
|
||||||
|
#else
|
||||||
|
assert(false && "not implement.");
|
||||||
|
return "";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace StringUtility
|
} // namespace StringUtility
|
||||||
|
Loading…
Reference in New Issue
Block a user