| 11 | #include <windows.h> |
| 12 | |
| 13 | std::string wstr_to_utf8(const WCHAR *wstr) |
| 14 | { |
| 15 | std::string ret; |
| 16 | |
| 17 | int len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, nullptr, 0, nullptr, nullptr); |
| 18 | if(len > 0) |
| 19 | { |
| 20 | ret.resize(len); |
| 21 | WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &ret[0], len, nullptr, nullptr); |
| 22 | ret.pop_back(); |
| 23 | } |
| 24 | |
| 25 | return ret; |
| 26 | } |
| 27 | |
| 28 | std::wstring utf8_to_wstr(const char *str) |
| 29 | { |
no test coverage detected