diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index c3c99982b..5a46db631 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -497,7 +497,7 @@ string JSONRPCRequest(const string& strMethod, const Array& params, const Value& request.push_back(Pair("method", strMethod)); request.push_back(Pair("params", params)); request.push_back(Pair("id", id)); - return write_string(Value(request), false) + "\n"; + return write_string(Value(request), raw_utf8) + "\n"; } Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id) @@ -515,7 +515,7 @@ Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id) string JSONRPCReply(const Value& result, const Value& error, const Value& id) { Object reply = JSONRPCReplyObj(result, error, id); - return write_string(Value(reply), false) + "\n"; + return write_string(Value(reply), raw_utf8) + "\n"; } void ErrorReply(std::ostream& stream, const Object& objError, const Value& id) @@ -945,7 +945,7 @@ static string JSONRPCExecBatch(const Array& vReq) for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++) ret.push_back(JSONRPCExecOne(vReq[reqIdx])); - return write_string(Value(ret), false) + "\n"; + return write_string(Value(ret), raw_utf8) + "\n"; } void ServiceConnection(AcceptedConnection *conn) @@ -1235,7 +1235,7 @@ int CommandLineRPC(int argc, char *argv[]) if (error.type() != null_type) { // Error - strPrint = "error: " + write_string(error, false); + strPrint = "error: " + write_string(error, raw_utf8); int code = find_value(error.get_obj(), "code").get_int(); nRet = abs(code); } @@ -1247,7 +1247,7 @@ int CommandLineRPC(int argc, char *argv[]) else if (result.type() == str_type) strPrint = result.get_str(); else - strPrint = write_string(result, true); + strPrint = write_string(result, pretty_print | raw_utf8); } } catch (boost::thread_interrupted) { diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 7f90f4a55..911cef41b 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -157,7 +157,7 @@ void RPCExecutor::request(const QString &command) else if (result.type() == json_spirit::str_type) strPrint = result.get_str(); else - strPrint = write_string(result, true); + strPrint = write_string(result, json_spirit::pretty_print | json_spirit::raw_utf8); emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint)); } @@ -171,7 +171,7 @@ void RPCExecutor::request(const QString &command) } catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message { // Show raw JSON object - emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false))); + emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), json_spirit::raw_utf8))); } } catch (std::exception& e) diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp index 2741672a8..fb8b74276 100644 --- a/src/test/base58_tests.cpp +++ b/src/test/base58_tests.cpp @@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(base58_EncodeBase58) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - std::string strTest = write_string(tv, false); + std::string strTest = write_string(tv, raw_utf8); if (test.size() < 2) // Allow for extra stuff (useful for comments) { BOOST_ERROR("Bad test: " << strTest); @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - std::string strTest = write_string(tv, false); + std::string strTest = write_string(tv, raw_utf8); if (test.size() < 2) // Allow for extra stuff (useful for comments) { BOOST_ERROR("Bad test: " << strTest); @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_parse) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - std::string strTest = write_string(tv, false); + std::string strTest = write_string(tv, raw_utf8); if (test.size() < 3) // Allow for extra stuff (useful for comments) { BOOST_ERROR("Bad test: " << strTest); @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_gen) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - std::string strTest = write_string(tv, false); + std::string strTest = write_string(tv, raw_utf8); if (test.size() < 3) // Allow for extra stuff (useful for comments) { BOOST_ERROR("Bad test: " << strTest); @@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_invalid) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - std::string strTest = write_string(tv, false); + std::string strTest = write_string(tv, raw_utf8); if (test.size() < 1) // Allow for extra stuff (useful for comments) { BOOST_ERROR("Bad test: " << strTest); diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index e7ad52627..b24f15d89 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(script_valid) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - string strTest = write_string(tv, false); + string strTest = write_string(tv, raw_utf8); if (test.size() < 2) // Allow size > 2; extra stuff ignored (useful for comments) { BOOST_ERROR("Bad test: " << strTest); @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(script_invalid) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - string strTest = write_string(tv, false); + string strTest = write_string(tv, raw_utf8); if (test.size() < 2) // Allow size > 2; extra stuff ignored (useful for comments) { BOOST_ERROR("Bad test: " << strTest); diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index ddff2acd4..9d6a63eb8 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE(tx_valid) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - string strTest = write_string(tv, false); + string strTest = write_string(tv, raw_utf8); if (test[0].type() == array_type) { if (test.size() != 3 || test[1].type() != str_type || test[2].type() != bool_type) @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(tx_invalid) BOOST_FOREACH(Value& tv, tests) { Array test = tv.get_array(); - string strTest = write_string(tv, false); + string strTest = write_string(tv, raw_utf8); if (test[0].type() == array_type) { if (test.size() != 3 || test[1].type() != str_type || test[2].type() != bool_type)