Boost C++ Libraries: Ticket #3367: all wchar_t c-strings are truncated on deserialization https://svn.boost.org/trac10/ticket/3367 <p> basic_binary_iprimitive&lt;Archive, Elem, Tr&gt;::load(wchar_t * ws) { </p> <blockquote> <p> std::size_t l; </p> </blockquote> <blockquote> <p> this-&gt;This()-&gt;load(l); </p> </blockquote> <blockquote> <p> load_binary(ws, l * sizeof(wchar_t) / sizeof(char)); </p> </blockquote> <blockquote> <p> ws[l / sizeof(wchar_t)] = L'\0'; </p> </blockquote> <p> } </p> <p> l is determined by std::wcslen on saving, which returns the number of wchar_t characters in the string. not the length in bytes. the \0 insert treats l as it was an offset in bytes. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3367 Trac 1.4.3 Robert Ramey Wed, 26 Aug 2009 20:56:36 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3367#comment:1 https://svn.boost.org/trac10/ticket/3367#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in trunk </p> <p> Robert Ramey </p> Ticket