P3904R1 — When paths go WTF: making formatting lossless (5 items) SG16
Victor Zverovich
This paper proposes making std::filesystem::path formatting fully lossless on Windows by using WTF-8 encoding to represent ill-formed UTF-16 paths containing unpaired surrogates. Currently, distinct paths with lone surrogates are formatted identically as replacement characters, causing silent data loss; WTF-8 preserves these code units losslessly while maintaining compatibility with std::print's terminal output behavior. This builds on P2845 (adopted in C++26) and aligns Windows path formatting behavior with POSIX, where arbitrary paths are already formatted losslessly.

References — Anthropic Citations API

[1]
"a superset of UTF-8 that can losslessly represent arbitrary sequences of 16-bit code unit (even if ill-formed in UTF-16)"
Summary: P3904R1 proposes making std::format for std::filesystem::path lossless on Windows by formatting the underlying UTF-16 code units via WTF-8 encoding rather than performing a lossy transcoding to the ordinary literal encoding. One surface-level grammatical issue was identified.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.