Boost C++ Libraries: Ticket #5769: fstream.hpp facilities not usable for paths containing characters outside of the current Windows ("ANSI") code page on GCC (mingw/mingw-w64) https://svn.boost.org/trac10/ticket/5769 <p> GCC's libstdc++ does not follow MS VC++'s lead in extending std::fstream and std::filebuf to take paths made up of wchar_t strings. </p> <p> boost::filesystem::filebuf and {i,o,}fstream rely on this functionality. In its absence, they fall back to converting the path's wchar_t representation into a char string in the Windows ("ANSI") code page of the current system locale (actually, they incorrectly use the current thread codepage, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5592" title="#5592: Bugs: Use CP_ACP not CP_THREAD_ACP [windows] (closed: fixed)">#5592</a>). </p> <p> The fstream facilities are therefore unusable with GCC when you build a Windows program that manipulates paths containing characters that are not representable in the current Windows code page. </p> <p> When compiled with the GCC from mingw-w64, the attached test will fail to create a file. Examination with Process Monitor reveals that the program tries to create a file with the name of "umbre??a", because the ☂ character is not representable in any Windows code page. </p> <p> GCC provides a <span class="underline">gnu_cxx::stdio_filebuf, which may be constructed from a FILE* or file descriptor; this could be used in concert with MSVCRT's _wfopen or _wopen functions, by boost::filesystem::{i,o,}fstream to provide the missing functionality. </span></p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5769 Trac 1.4.3 sam@… Wed, 10 Aug 2011 13:28:00 GMT attachment set https://svn.boost.org/trac10/ticket/5769 https://svn.boost.org/trac10/ticket/5769 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">fstest.cpp</span> </li> </ul> <p> Test case </p> Ticket anonymous Tue, 16 Aug 2011 11:26:17 GMT owner, status changed https://svn.boost.org/trac10/ticket/5769#comment:1 https://svn.boost.org/trac10/ticket/5769#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Beman Dawes</span> to <span class="trac-author-anonymous">anonymous</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> A patch would be much appreciated! </p> <p> Thanks for creating the issue, </p> <p> --Beman </p> Ticket sam@… Wed, 17 Aug 2011 17:08:49 GMT <link>https://svn.boost.org/trac10/ticket/5769#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5769#comment:2</guid> <description> <p> Having looked into this further, it seems stdio_filebuf does not provide an open function that takes a FILE* or file descriptor. This makes it rather difficult to implement b::f::filebuf::open on top of a stdio_filebuf. :( </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Wed, 21 Sep 2011 22:30:43 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/5769#comment:3 https://svn.boost.org/trac10/ticket/5769#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author-anonymous">anonymous</span> to <span class="trac-author">Beman Dawes</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> </ul> <p> reassigned to Beman </p> Ticket Dominik Schmidt <domme@…> Thu, 16 Oct 2014 03:47:11 GMT <link>https://svn.boost.org/trac10/ticket/5769#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5769#comment:4</guid> <description> <p> Does this help maybe htt*:<em>sourceforge.net/p/mingw-w64/mailman/message/29714455/ ? </em></p> </description> <category>Ticket</category> </item> <item> <author>fiesh@…</author> <pubDate>Mon, 24 Jul 2017 13:42:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5769#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5769#comment:5</guid> <description> <p> It would be great if the documentation could be upgraded to clarify this, at least as the bug remains. tut5.cpp for example does not work correctly when using mingw. It took us a lot of time to figure out that this was the reason for the issues in our codebase. I guess this makes boost::filesystem not usable under mingw? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 05 Oct 2017 09:42:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5769#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5769#comment:6</guid> <description> <p> The same has happened to us. :-( Is there any chance that tut5.cpp will be working with mingw in the near future? It should be mentioned in the documentation that mingw is not correctly supported right now! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 06 Oct 2017 07:58:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5769#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5769#comment:7</guid> <description> <p> There is a GPL library that has solved the problem: <a class="ext-link" href="https://www.guelkerdev.de/projects/pathie"><span class="icon">​</span>https://www.guelkerdev.de/projects/pathie</a>. Would it be possible to use their trick (make use of <span class="underline">gnu_cxx::stdio_filebuf extension) or otherwise mark Boost and/or Boost Filesystem as not really supporting MinGW?! Please! Otherwise many MinGW programmers could believe (like me) that Boost Filesystem solves their file opening problem which it doesn't!!! </span></p> </description> <category>Ticket</category> </item> </channel> </rss>