failed to print error code `:s` fail on windows due to encoding error
- Dominant language
- C++
- Stars
- 25.8k
- Forks
- 3.1k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
```cxx
#include
#include
#include
#include "fmt/ostream.h"
#include "fmt/std.h"
namespace fs = std::filesystem;
int main() {
const fs::path from{"/none1/a"}, to{"/none2/b"};
try {
fs::copy_file(from, to);
} catch (fs::filesystem_error const &ex) {
std::cout << "what(): " << ex.what() << '\n'
<< "path1(): " << ex.path1() << '\n'
<< "path2(): " << ex.path2() << '\n'
<< "code().value(): " << ex.code().value() << '\n'
<< "code().message(): " << ex.code().message() << '\n'
<< "code().category(): " << ex.code().category().name() << '\n';
try {
fmt::println("{:s}", ex.code());
} catch (std::exception &e) {
fmt::println("fmt error: {}", e.what());
}
}
fmt::println("exit");
return 0;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.