Subject: [Boost-bugs] [Boost C++ Libraries] #8632: incorrect write_json()\read_json() for not latin1 charset.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-30 05:00:28
#8632: incorrect write_json()\read_json() for not latin1 charset.
------------------------------------------------+---------------------------
Reporter: shirshov evgeny <381677383@â¦> | Owner: cornedbee
Type: Bugs | Status: new
Milestone: To Be Determined | Component: property_tree
Version: Boost 1.53.0 | Severity: Problem
Keywords: property_tree json_parser |
------------------------------------------------+---------------------------
use MSVC compiler.[[BR]]
{{{
property_tree::ptree pt_1; // use symbol > 127
property_tree::write_json("file", pt_1);
property_tree::ptree pt_2;
property_tree::read_json("file", pt_2);
pt_1 != pt_2; !!!!!
}}}
for property_tree::wptree all correct.
in msvc char = signed __int8.[[BR]]
typedef basic_string<char, char_traits<char>, allocator<char> >
string;[[BR]]
path:
file boost\property_tree\detail\json_parser_write.hpp
template<class Ch>
std::basic_string<Ch> create_escapes(const std::basic_string<Ch> &s)
{{{
typename std::basic_string<Ch>::const_iterator e = s.end();
while (b != e)
{
+ auto bb = static_cast<make_unsigned<Ch>::type>(*b);
// This assumes an ASCII superset. But so does everything in
PTree.
// We escape everything outside ASCII, because this code
can't
// handle high unicode characters.
- if (*b == 0x20 || *b == 0x21 || (*b >= 0x23 && *b <= 0x2E) ||
- (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && *b <= 0xFF))
+ if (bb == 0x20 || bb == 0x21 || (bb >= 0x23 && bb <= 0x2E) ||
+ (bb >= 0x30 && bb <= 0x5B) || (bb >= 0x5D && bb <= 0xFF))
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8632> 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