Boost logo

Boost :

Subject: Re: [boost] [nowide] Request for interest (nowide unicode support for windows)
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-06-17 15:22:57

Thats what Alexander Lamaison was talking about. And I like it. Even I would prefer that UTF-8 would be default. But does not mind require imbuing UTF-8 facet to locale. Small points: - This would not work on MinGW and many other compilers/standard libraries as they do not have wide overload for filebuf::open. - boost::details::utf8_codecvt... Does not support UTF-16 only UCS-2 so it would not work correctly on characters outside of BMP. But this is rather limitation of standard and problem in Boost's implementation of this facet. Still not sure if it is possible to implement this facet correctly in terms of definition of standard. But my code in nowide implements filebuf that uses "FILE *" and so it can be opened with "_wfopen" I think it can be adopted to Boost.Filesystem. Artyom --- On Thu, 6/17/10, Beman Dawes <bdawes_at_[hidden]> wrote: > From: Beman Dawes <bdawes_at_[hidden]> > Subject: Re: [boost] [nowide] Request for interest (nowide unicode support for windows) > To: "boost" <boost_at_[hidden]> > Date: Thursday, June 17, 2010, 9:52 PM > I thought some actual code might be > of interest. Attached is a > screenshot showing that the code worked as expected with > VC++ 9.0. > > --Beman > > #include <boost/filesystem/fstream.hpp> > #include > <boost/filesystem/detail/utf8_codecvt_facet.hpp> > #include <iostream> > > #define BOOST_FILESYSTEM_VERSION 3 > > int main() > { >   // "שלום" is "hello" in Hebrew; thanks to Artyom > for the example > >   std::locale global_loc = std::locale(); >   std::locale loc(global_loc, new > boost::filesystem::detail::utf8_codecvt_facet); >   std::locale old_loc = > boost::filesystem::path::imbue(loc); > >   boost::filesystem::ofstream f("שלום.narrow"); > >   return 0; > } > > -----Inline Attachment Follows----- > > _______________________________________________ > Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at