diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 54a5310dd..1852db336 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5157,9 +5157,14 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk) if(params.size() == 5) { opretValue = params[4].get_str(); + // Support a prefix "utf8:" which allows giving utf8 text instead of hex if(opretValue.get_str().substr(0,5) == "utf8:") { - // TODO: 1) remove the first 5 chars - // 2) convert remaining text to hex and store in opretValue + auto str = opretValue.get_str().substr(5); + if (utf8::is_valid(str)) { + opretValue = HexStr(str); + } else { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid utf8 in opreturn"); + } } }