[Boost-bugs] [Boost C++ Libraries] #8883: property_tree JSON reader does not parse unicode characters properly

Subject: [Boost-bugs] [Boost C++ Libraries] #8883: property_tree JSON reader does not parse unicode characters properly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-07-23 08:32:37


#8883: property_tree JSON reader does not parse unicode characters properly
----------------------------------------+---------------------------
 Reporter: Ronny Krueger <rk@…> | Owner: cornedbee
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: property_tree
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: property_tree JSON unicode |
----------------------------------------+---------------------------
 The JSON writer converts every character outside the ASCII range (>127) to
 \u notation (e.g. an 'ä' in UTF-8 will become \u00C3\u00A4 ). The JSON
 reader on the other hand does not read such \u encoded characters back
 properly. The reason is the a_unicode struct in json_parser_read.hpp.

 This code:

 {{{
 u = (std::min)(u, static_cast<unsigned
 long>((std::numeric_limits<Ch>::max)()));
 }}}

 should actually be more like this:

 {{{
 typedef typename make_unsigned<Ch>::type UCh;
 u = (std::min)(u, static_cast<unsigned
 long>((std::numeric_limits<UCh>::max)()));
 }}}

 Otherwise every \u escaped character whose value is by definition greater
 than 127 will be clamped to 127 and will therefor never get its original
 value.

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