Boost C++ Libraries: Ticket #9870: boost::property_tree::write_xml_element does not encode character before writing to attribute value https://svn.boost.org/trac10/ticket/9870 <p> The character in attribute value is not encoded in entity names and may output a quote " to attribute value which escapes the attribute value and thus outputs a wrong value. </p> <p> if the attribute stored in attribs is ("mystring", "\"") under node x. The expected output string is &lt;x mystring="&amp;quot;"/&gt; instead of &lt;x mystring="""/&gt;. The value is &amp;quot;, but not null string and the quote in the tag should be balanced. </p> <p> This can resolve by changing "boost/property_tree/detail/xml_parser_write.hpp" Line 118 to 119 from </p> <pre class="wiki">stream &lt;&lt; Ch(' ') &lt;&lt; it-&gt;first &lt;&lt; Ch('=') &lt;&lt; Ch('"') &lt;&lt; it-&gt;second.template get_value&lt;std::basic_string&lt;Ch&gt; &gt;() &lt;&lt; Ch('"'); </pre><p> to </p> <pre class="wiki">stream &lt;&lt; Ch(' ') &lt;&lt; it-&gt;first &lt;&lt; Ch('=') &lt;&lt; Ch('"') &lt;&lt; encode_char_entities(it-&gt;second.template get_value&lt;std::basic_string&lt;Ch&gt; &gt;()) &lt;&lt; Ch('"'); </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9870 Trac 1.4.3 Alex K Yau <alex.yau@…> Thu, 10 Apr 2014 08:16:43 GMT version changed https://svn.boost.org/trac10/ticket/9870#comment:1 https://svn.boost.org/trac10/ticket/9870#comment:1 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.55.0</span> → <span class="trac-field-new">Boost 1.46.1</span> </li> </ul> <p> Sorry the bug has been fixed in v1.55.0. Sorry about a false alarm. The bug was found originally in v1.46.1. </p> Ticket Sebastian Redl Fri, 11 Apr 2014 16:57:50 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9870#comment:2 https://svn.boost.org/trac10/ticket/9870#comment:2 <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">invalid</span> </li> </ul> Ticket