Boost logo

Boost :

Subject: Re: [boost] [nowide] Request for interest (nowide unicode support for windows)
From: Beman Dawes (bdawes_at_[hidden])
Date: 2010-06-17 14:52:40


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;
}



screen-shot.jpg

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk