Impl GB2312ToUtf8
This commit is contained in:
parent
322d62c8b8
commit
6b954e0a4b
@ -35,6 +35,21 @@ string Wstring2String(wstring ws)
|
||||
return s;
|
||||
}
|
||||
|
||||
string GB2312ToUtf8(const char *gb2312)
|
||||
{
|
||||
int size_needed = 0;
|
||||
|
||||
size_needed = MultiByteToWideChar(CP_ACP, 0, gb2312, -1, NULL, 0);
|
||||
wstring ws(size_needed, 0);
|
||||
MultiByteToWideChar(CP_ACP, 0, gb2312, -1, &ws[0], size_needed);
|
||||
|
||||
size_needed = WideCharToMultiByte(CP_UTF8, 0, &ws[0], -1, NULL, 0, NULL, NULL);
|
||||
string s(size_needed, 0);
|
||||
WideCharToMultiByte(CP_UTF8, 0, &ws[0], -1, &s[0], size_needed, NULL, NULL);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static int GetWeChatPath(wchar_t *path)
|
||||
{
|
||||
int ret = -1;
|
||||
|
@ -28,6 +28,7 @@ DWORD GetMemoryIntByAddress(HANDLE hProcess, DWORD address);
|
||||
std::wstring GetUnicodeInfoByAddress(HANDLE hProcess, DWORD address);
|
||||
std::wstring String2Wstring(std::string s);
|
||||
std::string Wstring2String(std::wstring ws);
|
||||
std::string GB2312ToUtf8(const char *gb2312);
|
||||
std::string GetStringByAddress(DWORD address);
|
||||
std::string GetStringByStrAddr(DWORD addr);
|
||||
std::string GetStringByWstrAddr(DWORD addr);
|
||||
|
Loading…
Reference in New Issue
Block a user