[Boost-bugs] [Boost C++ Libraries] #11981: boost::archive::xml_woarchive with locale dosen't work

Subject: [Boost-bugs] [Boost C++ Libraries] #11981: boost::archive::xml_woarchive with locale dosen't work
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-12 03:57:43


#11981: boost::archive::xml_woarchive with locale dosen't work
--------------------------------------------------+---------------------
 Reporter: anonymous | Owner: artyom
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: locale
  Version: Boost 1.60.0 | Severity: Problem
 Keywords: locale, xml_woarchive, serialization |
--------------------------------------------------+---------------------
 New locale library seems to have a bug.
 "Implemented generic codecvt facet and add general purpose utf8_codecvt
 facet"

 {{{
 #include <string>
 #include <locale>
 #include <fstream>
 #include <boost/serialization/string.hpp>
 #include <boost/serialization/nvp.hpp>
 #include <boost/archive/xml_woarchive.hpp>
 #include <boost/archive/xml_wiarchive.hpp>

 int wmain(int argc, wchar_t* argv[])
 {
     std::locale::global(std::locale("japanese"));

     std::wofstream wofs("output.xml");
     boost::archive::xml_woarchive oa(wofs); // exception in 1.60
     oa << boost::serialization::make_nvp("string", std::string("日本語文字列"));
     wofs.close();

     std::string str;
     std::wifstream wifs("output.xml");
     boost::archive::xml_wiarchive ia(wifs);
     ia >> boost::serialization::make_nvp("string", str);
     wifs.close();

     return 0;
 }
 }}}

 An exception occurs in boost 1.60 in Visual Studio 2013.
 "invalid multbyte/wide char conversion".

 This exception doesn't occur in boost 1.59, but this code makes invalid
 xml.
 The encoding is not UTF-8 but SJIS.

 In boost 1.57, it makes valid UTF-8 encoding xml.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11981>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC