failed to print error code `:s` fail on windows due to encoding error
Maintainers usually reply within 9 days
@shreyas-s1403 is already working on this.
Since Oct 23, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by compiling and running the supplied filesystem-error reproducer on Windows, then trace how fmt handles std::error_code with the {:s} formatter. Done means the example prints the error code without an encoding exception while preserving the other displayed values.
Written by the indexing model from the issue text.
Description
#include <exception>
#include <filesystem>
#include <iostream>
#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;
}
- Dominant language
- C++
- Stars
- 25.9k
- Forks
- 3.1k
- Avg merge
- 9d 5h
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fmtlib/fmt
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 9 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
fmtlib/fmt#5006 · 3 comments ·
Maintainers usually reply within 9 days
-
Difficulty 3/5 1-2 days Newbie friendliness 63/100
Maintainers usually reply within 9 days
-
<stdfloat>May be free again @shreyas-s1403 claimed this 13 days ago, and no pull request is open. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
fmtlib/fmt#4725 · 10 comments · 1 reaction ·
Maintainers usually reply within 9 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
fmtlib/fmt#4518 · 1 comment · 6 reactions ·
Maintainers usually reply within 9 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA-RTX/NRI#312 ·
Maintainers usually reply within 1 day
-
permute_q_b_proj / permute_wv_proj accept scale factors from another devicePossibly taken @0z5a claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepseek-ai/FlashMLA#247 ·
Maintainers usually reply within 1 day
-
Linux npm packaging leaves workspace files that block subsequent CI checkoutPossibly taken @Spockkk0225 claimed this today. Openci
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
alibaba/neug#1195 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days