boost.property_tree读取中文乱码问题

#include "boost/program_options/detail/utf8_codecvt_facet.hpp"



int test()

{

std::wifstream f(L"测试.xml");

std::locale utf8Locale(std::locale(),new boost::program_options::detail::utf8_codecvt_facet());

f.imbue(utf8Locale);



if(f)

{

boost::property_tree::read_xml(f,pt);

std::wstring text = pt.get(L"test",L"");

MessageBox(NULL,text.c_str(),L"",MB_OK);

}

}

  

你可能感兴趣的:(property)