Skip to content

Commit 2ecb755

Browse files
author
constantined
committed
Switch to using raw_utf8
1 parent 2227389 commit 2ecb755

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/bitcoinrpc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ string JSONRPCRequest(const string& strMethod, const Array& params, const Value&
497497
request.push_back(Pair("method", strMethod));
498498
request.push_back(Pair("params", params));
499499
request.push_back(Pair("id", id));
500-
return write_string(Value(request), false) + "\n";
500+
return write_string(Value(request), raw_utf8) + "\n";
501501
}
502502

503503
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)
515515
string JSONRPCReply(const Value& result, const Value& error, const Value& id)
516516
{
517517
Object reply = JSONRPCReplyObj(result, error, id);
518-
return write_string(Value(reply), false) + "\n";
518+
return write_string(Value(reply), raw_utf8) + "\n";
519519
}
520520

521521
void ErrorReply(std::ostream& stream, const Object& objError, const Value& id)
@@ -945,7 +945,7 @@ static string JSONRPCExecBatch(const Array& vReq)
945945
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
946946
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
947947

948-
return write_string(Value(ret), false) + "\n";
948+
return write_string(Value(ret), raw_utf8) + "\n";
949949
}
950950

951951
void ServiceConnection(AcceptedConnection *conn)
@@ -1235,7 +1235,7 @@ int CommandLineRPC(int argc, char *argv[])
12351235
if (error.type() != null_type)
12361236
{
12371237
// Error
1238-
strPrint = "error: " + write_string(error, false);
1238+
strPrint = "error: " + write_string(error, raw_utf8);
12391239
int code = find_value(error.get_obj(), "code").get_int();
12401240
nRet = abs(code);
12411241
}
@@ -1247,7 +1247,7 @@ int CommandLineRPC(int argc, char *argv[])
12471247
else if (result.type() == str_type)
12481248
strPrint = result.get_str();
12491249
else
1250-
strPrint = write_string(result, true);
1250+
strPrint = write_string(result, pretty_print | raw_utf8);
12511251
}
12521252
}
12531253
catch (boost::thread_interrupted) {

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void RPCExecutor::request(const QString &command)
157157
else if (result.type() == json_spirit::str_type)
158158
strPrint = result.get_str();
159159
else
160-
strPrint = write_string(result, true);
160+
strPrint = write_string(result, json_spirit::pretty_print | json_spirit::raw_utf8);
161161

162162
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
163163
}
@@ -171,7 +171,7 @@ void RPCExecutor::request(const QString &command)
171171
}
172172
catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message
173173
{ // Show raw JSON object
174-
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
174+
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), json_spirit::raw_utf8)));
175175
}
176176
}
177177
catch (std::exception& e)

src/test/base58_tests.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
1919
BOOST_FOREACH(Value& tv, tests)
2020
{
2121
Array test = tv.get_array();
22-
std::string strTest = write_string(tv, false);
22+
std::string strTest = write_string(tv, raw_utf8);
2323
if (test.size() < 2) // Allow for extra stuff (useful for comments)
2424
{
2525
BOOST_ERROR("Bad test: " << strTest);
@@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
4242
BOOST_FOREACH(Value& tv, tests)
4343
{
4444
Array test = tv.get_array();
45-
std::string strTest = write_string(tv, false);
45+
std::string strTest = write_string(tv, raw_utf8);
4646
if (test.size() < 2) // Allow for extra stuff (useful for comments)
4747
{
4848
BOOST_ERROR("Bad test: " << strTest);
@@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_parse)
114114
BOOST_FOREACH(Value& tv, tests)
115115
{
116116
Array test = tv.get_array();
117-
std::string strTest = write_string(tv, false);
117+
std::string strTest = write_string(tv, raw_utf8);
118118
if (test.size() < 3) // Allow for extra stuff (useful for comments)
119119
{
120120
BOOST_ERROR("Bad test: " << strTest);
@@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_gen)
171171
BOOST_FOREACH(Value& tv, tests)
172172
{
173173
Array test = tv.get_array();
174-
std::string strTest = write_string(tv, false);
174+
std::string strTest = write_string(tv, raw_utf8);
175175
if (test.size() < 3) // Allow for extra stuff (useful for comments)
176176
{
177177
BOOST_ERROR("Bad test: " << strTest);
@@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_invalid)
240240
BOOST_FOREACH(Value& tv, tests)
241241
{
242242
Array test = tv.get_array();
243-
std::string strTest = write_string(tv, false);
243+
std::string strTest = write_string(tv, raw_utf8);
244244
if (test.size() < 1) // Allow for extra stuff (useful for comments)
245245
{
246246
BOOST_ERROR("Bad test: " << strTest);

src/test/script_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(script_valid)
131131
BOOST_FOREACH(Value& tv, tests)
132132
{
133133
Array test = tv.get_array();
134-
string strTest = write_string(tv, false);
134+
string strTest = write_string(tv, raw_utf8);
135135
if (test.size() < 2) // Allow size > 2; extra stuff ignored (useful for comments)
136136
{
137137
BOOST_ERROR("Bad test: " << strTest);
@@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(script_invalid)
155155
BOOST_FOREACH(Value& tv, tests)
156156
{
157157
Array test = tv.get_array();
158-
string strTest = write_string(tv, false);
158+
string strTest = write_string(tv, raw_utf8);
159159
if (test.size() < 2) // Allow size > 2; extra stuff ignored (useful for comments)
160160
{
161161
BOOST_ERROR("Bad test: " << strTest);

src/test/transaction_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE(tx_valid)
2727
BOOST_FOREACH(Value& tv, tests)
2828
{
2929
Array test = tv.get_array();
30-
string strTest = write_string(tv, false);
30+
string strTest = write_string(tv, raw_utf8);
3131
if (test[0].type() == array_type)
3232
{
3333
if (test.size() != 3 || test[1].type() != str_type || test[2].type() != bool_type)
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(tx_invalid)
9696
BOOST_FOREACH(Value& tv, tests)
9797
{
9898
Array test = tv.get_array();
99-
string strTest = write_string(tv, false);
99+
string strTest = write_string(tv, raw_utf8);
100100
if (test[0].type() == array_type)
101101
{
102102
if (test.size() != 3 || test[1].type() != str_type || test[2].type() != bool_type)

0 commit comments

Comments
 (0)