2 comments

  • Longhanks51 minutes ago
    &gt; 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&lt;std::filesystem::path&gt; converts Windows native UTC-16 to UTF-8 using Unicode transcoding and avoiding code pages, therefore solving the problem.<p>...only to then convert it back to UTF-16 for WriteConsoleW(), which std::print() usually calls (unless not running in a console) (<a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;STL&#x2F;blob&#x2F;488e7953685722d2d6666f764c1f2f61958bba76&#x2F;stl&#x2F;src&#x2F;print.cpp#L246" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;STL&#x2F;blob&#x2F;488e7953685722d2d6666f...</a>).
  • veltas1 hour ago
    Surely std::print() shouldn&#x27;t print anything?
    • CamouflagedKiwi1 hour ago
      It&#x27;s a typo, he describes it as std::println in the text, but the code snippet is just print()
    • steeleduncan1 hour ago
      I think it is a typo, and should be std::println()
    • nikbackm1 hour ago
      Why even call it in that case?
      • xuhu1 hour ago
        It&#x27;s apparently a typo in the article, they probably meant to write `println()`.