Boost C++ Libraries: Ticket #8632: incorrect write_json()\read_json() for not latin1 charset. https://svn.boost.org/trac10/ticket/8632 <p> use MSVC compiler.<br /> </p> <pre class="wiki">property_tree::ptree pt_1; // use symbol &gt; 127 property_tree::write_json("file", pt_1); property_tree::ptree pt_2; property_tree::read_json("file", pt_2); pt_1 != pt_2; !!!!! </pre><p> for property_tree::wptree all correct. </p> <p> in msvc char = signed <span class="underline">int8.<br /> typedef basic_string&lt;char, char_traits&lt;char&gt;, allocator&lt;char&gt; &gt; </span></p> <blockquote> <p> string;<br /> </p> </blockquote> <p> path: file boost\property_tree\detail\json_parser_write.hpp </p> <blockquote> <p> template&lt;class Ch&gt; std::basic_string&lt;Ch&gt; create_escapes(const std::basic_string&lt;Ch&gt; &amp;s) </p> </blockquote> <pre class="wiki"> typename std::basic_string&lt;Ch&gt;::const_iterator e = s.end(); while (b != e) { + auto bb = static_cast&lt;make_unsigned&lt;Ch&gt;::type&gt;(*b); // This assumes an ASCII superset. But so does everything in PTree. // We escape everything outside ASCII, because this code can't // handle high unicode characters. - if (*b == 0x20 || *b == 0x21 || (*b &gt;= 0x23 &amp;&amp; *b &lt;= 0x2E) || - (*b &gt;= 0x30 &amp;&amp; *b &lt;= 0x5B) || (*b &gt;= 0x5D &amp;&amp; *b &lt;= 0xFF)) + if (bb == 0x20 || bb == 0x21 || (bb &gt;= 0x23 &amp;&amp; bb &lt;= 0x2E) || + (bb &gt;= 0x30 &amp;&amp; bb &lt;= 0x5B) || (bb &gt;= 0x5D &amp;&amp; bb &lt;= 0xFF)) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8632 Trac 1.4.3 Sebastian Redl Fri, 23 Jan 2015 11:04:54 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8632#comment:1 https://svn.boost.org/trac10/ticket/8632#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">duplicate</span> </li> </ul> <p> Reported again (and fixed there) in bug 10820. </p> Ticket