Re: [Boost-bugs] [Boost C++ Libraries] #5033: Property Tree JSON Parser cannot handle utf-8 string correctly.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5033: Property Tree JSON Parser cannot handle utf-8 string correctly.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-07-17 18:18:28


#5033: Property Tree JSON Parser cannot handle utf-8 string correctly.
--------------------------------------+---------------------------
  Reporter: Lorin Liu <liu.lorin@…> | Owner: cornedbee
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: property_tree
   Version: Boost 1.45.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------+---------------------------

Comment (by bmccart@…):

 Encoding of JSON strings is straightforward for utf8 encoding. The
 specification says that 'any' Unicode character except '"' or '\' may be
 literally represented in the string. For utf8 encoding, either parse the
 std::string to determine code points, and if any code point (1-4 chars in
 utf8) contains '"' or '\' chars then the whole code point needs to be
 escaped with "\uXXXX" or "\uXXXX\uXXXX" Which is actually UTF16).
 Otherwise you can dump the 1-4 literal chars into the JSON string content.

 When decoding JSON strings, the escaped unicode chars (UTF16) must be
 decoded and converted back to UTF8 chars which can be literally injected
 into the result string.

 http://www.ietf.org/rfc/rfc4627.txt (Sec 2.5)
 http://www.json.org/

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5033#comment:6>
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:13 UTC