|
|
|
@ -25,7 +25,8 @@ TcharString CharToTchar(std::string input) { |
|
|
|
|
int needed = MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, NULL, 0); |
|
|
|
|
if (needed <= 0) return TcharString(); |
|
|
|
|
TcharString ret(needed, L'\0'); |
|
|
|
|
MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, ret.c_str(), needed); |
|
|
|
|
MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, |
|
|
|
|
const_cast<LPTSTR>(ret.data()), needed); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -34,8 +35,8 @@ std::string TcharToChar(TcharString input) { |
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, input.c_str(), -1, NULL, 0, NULL, NULL); |
|
|
|
|
if (needed <= 0) return std::string(); |
|
|
|
|
std::string ret(needed, '\0'); |
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, input.c_str(), -1, ret.c_str(), needed, NULL, |
|
|
|
|
NULL); |
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, input.c_str(), -1, |
|
|
|
|
const_cast<LPSTR>(ret.data()), needed, NULL, NULL); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|