[Boost-bugs] [Boost C++ Libraries] #4326: Property tree json reader and writer aren't standards-compliant

Subject: [Boost-bugs] [Boost C++ Libraries] #4326: Property tree json reader and writer aren't standards-compliant
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-09 15:30:28


#4326: Property tree json reader and writer aren't standards-compliant
--------------------------------------------+-------------------------------
 Reporter: Leon Mergen <leon@…> | Owner: cornedbee
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: property_tree
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
--------------------------------------------+-------------------------------
 According to the json standard, the "/" character should be escaped to
 "\/". The boost property tree Json parser generates an error when such an
 escape sequence is encountered on input, and doesn't properly escape it on
 output.


 Here is a patch for the two files based on the 1.43 tree:

 {{{

 --- ./json_parser_read.hpp 2010-06-09 15:20:17.000000000 +0000
 +++ ./json_parser_read.hpp.old 2010-06-09 15:24:43.000000000 +0000
 @@ -128,7 +128,6 @@
                  {
                      case Ch('\"'): c.string += Ch('\"'); break;
                      case Ch('\\'): c.string += Ch('\\'); break;
 - case Ch('/'): c.string += Ch('/'); break;
                      case Ch('0'): c.string += Ch('\0'); break;
                      case Ch('b'): c.string += Ch('\b'); break;
                      case Ch('f'): c.string += Ch('\f'); break;
 @@ -247,7 +246,7 @@
                          ;

                  escape
 - =
 chset_p(detail::widen<Ch>("\"\\/0bfnrt").c_str())[typename
 Context::a_escape(self.c)]
 + =
 chset_p(detail::widen<Ch>("\"\\0bfnrt").c_str())[typename
 Context::a_escape(self.c)]
                          | 'u' >> uint_parser<unsigned long, 16, 4,
 4>()[typename Context::a_unicode(self.c)]
                          ;


 --- ./json_parser_write.hpp 2010-06-09 15:15:47.000000000 +0000
 +++ ./json_parser_write.hpp.old 2010-06-09 15:24:51.000000000 +0000
 @@ -36,7 +36,6 @@
              else if (*b == Ch('\r')) result += Ch('\\'), result +=
 Ch('r');
              else if (*b == Ch('"')) result += Ch('\\'), result +=
 Ch('"');
              else if (*b == Ch('\\')) result += Ch('\\'), result +=
 Ch('\\');
 - else if (*b == Ch('/')) result += Ch('\\'), result +=
 Ch('/');
              else
              {
                  if (std::isprint(*b, loc))


 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4326>
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:03 UTC