111
This commit is contained in:
@@ -150,3 +150,20 @@ public:
|
||||
static DWORD Motify_memory_attributes(int address, DWORD attributes = PAGE_EXECUTE_READWRITE);
|
||||
};
|
||||
|
||||
|
||||
|
||||
static char* GBKTOUTF8(std::string& strGBK)//转码 GBK编码转成UTF8编码
|
||||
{
|
||||
int len = MultiByteToWideChar(CP_ACP, 0, strGBK.c_str(), -1, NULL, 0);
|
||||
wchar_t* wszUtf8 = new wchar_t[len];
|
||||
memset(wszUtf8, 0, len);
|
||||
MultiByteToWideChar(CP_ACP, 0, strGBK.c_str(), -1, wszUtf8, len);
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, wszUtf8, -1, NULL, 0, NULL, NULL);
|
||||
char* szUtf8 = new char[len + 1];
|
||||
memset(szUtf8, 0, len + 1);
|
||||
WideCharToMultiByte(CP_UTF8, 0, wszUtf8, -1, szUtf8, len, NULL, NULL);
|
||||
strGBK = szUtf8;
|
||||
delete[] szUtf8;
|
||||
delete[] wszUtf8;
|
||||
return (char*)strGBK.c_str();
|
||||
}
|
||||
Reference in New Issue
Block a user