Boost logo

Boost Users :

Subject: [Boost-users] [Filesystem] [Locale] Unicode filenames doc example error
From: Egor Tensin (egor.tensin_at_[hidden])
Date: 2013-12-04 12:42:00


Why doesn't this simple code from the Boost.Locale docs work?

#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/locale.hpp>

#include <exception>
#include <iostream>

int main()
{
  try
  {
    std::locale::global(boost::locale::generator().generate(""));
    boost::filesystem::path::imbue(std::locale());
    boost::filesystem::ofstream hello("привет.txt");
  }
  catch (const std::exception& e)
  {
    std::cerr << e.what() << std::endl;
  }

  return 0;
}

Compiled with

>cl /EHsc /D _UNICODE /D UNICODE b.cpp /I%BOOST_ROOT% /MD /link /LIBPATH:%BOOST_ROOT%\stage\lib

it gives me

>b.exe
boost::filesystem::path codecvt to wstring: error

Could someone please explain what's the problem there and how do I
handle Unicode file names on Windows using Boost.Filesystem &
Boost.Locale?

I'm using Boost 1.55.0 & compiling with MS Visual C++ 2010 compiler
v.16.00.30319.01.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net