| 144 | #ifdef LAF_WINDOWS |
| 145 | |
| 146 | std::string to_utf8(const wchar_t* src, const size_t n) |
| 147 | { |
| 148 | int required_size = ::WideCharToMultiByte(CP_UTF8, 0, src, (int)n, NULL, 0, NULL, NULL); |
| 149 | |
| 150 | if (required_size == 0) |
| 151 | return std::string(); |
| 152 | |
| 153 | std::vector<char> buf(++required_size); |
| 154 | |
| 155 | ::WideCharToMultiByte(CP_UTF8, 0, src, (int)n, &buf[0], required_size, NULL, NULL); |
| 156 | |
| 157 | return std::string(&buf[0]); |
| 158 | } |
| 159 | |
| 160 | std::wstring from_utf8(const std::string& src) |
| 161 | { |
no test coverage detected