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