diff --git a/src/SFML/System/Utils.cpp b/src/SFML/System/Utils.cpp index 7150106f6..53acf060f 100644 --- a/src/SFML/System/Utils.cpp +++ b/src/SFML/System/Utils.cpp @@ -44,8 +44,10 @@ std::string toLower(std::string str) std::string formatDebugPathInfo(const std::filesystem::path& path) { std::ostringstream oss; - oss << " Provided path: " << path << '\n' // - << " Absolute path: " << std::filesystem::absolute(path); + // convert to UTF-8 to handle non-ascii/non-latin1 filenames on windows + // cast is required to work in C++20 where u8string is char8_t which can't be printed to char stream + oss << " Provided path: " << reinterpret_cast(path.u8string().c_str()) << '\n' // + << " Absolute path: " << reinterpret_cast(std::filesystem::absolute(path).u8string().c_str()); return oss.str(); }