Convert a filesystem path to a UTF-8 std::string. On Windows, path.string() returns a locale-dependent narrow string, which mangles non-ASCII characters before they reach OIIO. path.u8string() always yields UTF-8 bytes, but its return type changes from std::string in C++17 to std::u8string in C++20; the reinterpret_cast keeps this portable.
| 70 | // UTF-8 bytes, but its return type changes from std::string in C++17 to |
| 71 | // std::u8string in C++20; the reinterpret_cast keeps this portable. |
| 72 | std::string PathToUtf8(const std::filesystem::path& path) { |
| 73 | const auto u8 = path.u8string(); |
| 74 | return std::string(reinterpret_cast<const char*>(u8.data()), u8.size()); |
| 75 | } |
| 76 | |
| 77 | std::vector<uint8_t> ConvertColorSpace(const uint8_t* src_data, |
| 78 | int width, |