For Windows, we convert the UTF-8 path to a UTF-16 path to force using the APIs that correctly handle unicode characters.
| 25 | // For Windows, we convert the UTF-8 path to a UTF-16 path to force using |
| 26 | // the APIs that correctly handle unicode characters. |
| 27 | inline std::wstring DecodeUTF8Path(std::string path) { |
| 28 | std::wstring result; |
| 29 | int len = MultiByteToWideChar(CP_UTF8, 0, path.c_str(), static_cast<int>(path.length()), NULL, 0); |
| 30 | if (len > 0) |
| 31 | { |
| 32 | result.resize(len); |
| 33 | MultiByteToWideChar(CP_UTF8, 0, path.c_str(), static_cast<int>(path.length()), &result[0], len); |
| 34 | } |
| 35 | return result; |
| 36 | } |
| 37 | #else |
| 38 | // For other platforms there is no need for any conversion, they |
| 39 | // support UTF-8 natively. |
no test coverage detected