[Boost-bugs] [Boost C++ Libraries] #1836: bug in serializing wide character strings

Subject: [Boost-bugs] [Boost C++ Libraries] #1836: bug in serializing wide character strings
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-17 21:12:21


#1836: bug in serializing wide character strings
----------------------------------------------+-----------------------------
 Reporter: Jeff Faust <jeff_at_[hidden]> | Owner: ramey
     Type: Bugs | Status: new
Milestone: Boost 1.35.1 | Component: serialization
  Version: Boost 1.34.1 | Severity: Problem
 Keywords: wstring wchar_t |
----------------------------------------------+-----------------------------
 We've discovered an issue Boost has writing and reading wide character
 strings (wchar_t* and std::wstrings) to non-wide character file streams
 (std::ifstream and std::ofstream). The issue stems from the fact that
 wide characters are written and read as a sequence of characters (in
 text_oarchive_impl.ipp and text_iarchive_impl.ipp, respectively). For
 text streams, an EOF character terminates the reading of a file on
 Windows.
 Some wide characters have EOF (value = 26 decimal) as one of the bytes so
 reading that byte causes early termination of the read. We have worked
 around the issue by deriving our own input and output archives from
 text_i|oarchive_impl<Archive> and overriding load_override() and
 save_override for std::wstring and wchar_t*. Our implementation just
 sequences through the wide characters and writes them 1 by 1 as
 wchar_t to the archive. This isn't very elegant and is even less readable
 in the file than the current implementation but does resolve the problem.

 Although the test test_simple_class does test wstrings, it only uses
 characters 'a'-'z' which does not expose this problem.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1836>
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:49:57 UTC