| ▲ | Improvements to Std:Format in C++26(mariusbancila.ro) | ||||||||||||||||||||||||||||||||||
| 22 points by jandeboevrie 2 days ago | 7 comments | |||||||||||||||||||||||||||||||||||
| ▲ | Longhanks 2 hours ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
> A related issue solved along was Windows string representation of paths. std::filesystem::path stores its text in wchar_t encoded as UTF-16 (Windows native). But p.string() narrows it down to the active code page, rather than UTF-8 which is what the formatting library expects. The result was a non-ASCII path could get transcoded to gibberish. The C++26 std::formatter<std::filesystem::path> converts Windows native UTC-16 to UTF-8 using Unicode transcoding and avoiding code pages, therefore solving the problem. ...only to then convert it back to UTF-16 for WriteConsoleW(), which std::print() usually calls (unless not running in a console) (https://github.com/microsoft/STL/blob/488e7953685722d2d6666f...). | |||||||||||||||||||||||||||||||||||
| ▲ | veltas 2 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
Surely std::print() shouldn't print anything? | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||