Re: [Boost-bugs] [Boost C++ Libraries] #3827: Embeded null written as \0 rather than \u0000 in property_tree::write_json

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3827: Embeded null written as \0 rather than \u0000 in property_tree::write_json
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-01-08 00:06:32


#3827: Embeded null written as \0 rather than \u0000 in property_tree::write_json
-----------------------------------------------------+----------------------
 Reporter: Michael Anderson <drmikeando@…> | Owner: cornedbee
     Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: property_tree
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-----------------------------------------------------+----------------------

Comment(by Michael Anderson <drmikeando@…>):

 The fix is pretty easy, heres a patch from svn diff
 {{{
 ===================================================================
 --- boost/property_tree/detail/json_parser_write.hpp (revision 58794)
 +++ boost/property_tree/detail/json_parser_write.hpp (working copy)
 @@ -29,8 +29,7 @@
          typename std::basic_string<Ch>::const_iterator e = s.end();
          while (b != e)
          {
 - if (*b == Ch('\0')) result += Ch('\\'), result += Ch('0');
 - else if (*b == Ch('\b')) result += Ch('\\'), result +=
 Ch('b');
 + if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b');
              else if (*b == Ch('\f')) result += Ch('\\'), result +=
 Ch('f');
              else if (*b == Ch('\n')) result += Ch('\\'), result +=
 Ch('n');
              else if (*b == Ch('\r')) result += Ch('\\'), result +=
 Ch('r');
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3827#comment:1>
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:02 UTC