Closed dkd1111 closed 3 years ago
/*CODE_1*/ boost::beast::http::response<boost::beast::http::string_body> &&res ... std::stringstream ss; ss << res.body(); boost::property_tree::ptree tree{}; boost::property_tree::read_json(ss, tree);
CODE_1 is fine.
/*CODE_2*/ boost::beast::http::response<boost::beast::http::string_body> &&res ... std::stringstream ss; ss << res.body(); std::string msg; msg << ss.str(); ss.clear(); ss << msg; boost::property_tree::ptree tree{}; boost::property_tree::read_json(ss, tree);
CODE_2 throws exception("garbage after data").
Variable "ss" is encoded utf-8. Why does read_json(..) throw exception for utf-8 stringstream from string?
CODE_1 is fine.
CODE_2 throws exception("garbage after data").
Variable "ss" is encoded utf-8. Why does read_json(..) throw exception for utf-8 stringstream from string?