What encoding is used for return values


#1

Hi,

I have a function that returns a bytes32[] [i.e. returns(bytes32[] _keys)].
When I call the function from the STRATO GUI, I get the following return value:
“data”: {
“tag”: “Call”,
“contents”: [
[
"Oá_T²†ô\f-_A›xQªÛ:Æ#|ó(¹Iô\u000bÈß2"*
]
]
}
What encoding is being used here? How can I convert the returned value back to a bytes32?

Thanks

The complete returned result is:
{
“status”: “Success”,
“hash”: “5e0a6a1eba8b7d562b4d108d4e137a1a8b3f653d2da05fc826aa2060791d3931”,
“txResult”: {
“deletedStorage”: “”,
“contractsDeleted”: “”,
“gasUsed”: “fffffffffffffffffffffffffffffffffffffeda7a9f7f2a4e6fa9e87412e462”,
“stateDiff”: “”,
“time”: 0.002088,
“response”: “000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000014fe12a5f7f54b286f40c2d9d5f419b7851aadb3ac6237cf328b949f40bc8df32”,
“blockHash”: “601e98bfdd79106f582e2ccd06863c2b5a69460bd6181ceaed426be7dc1853fd”,
“transactionHash”: “5e0a6a1eba8b7d562b4d108d4e137a1a8b3f653d2da05fc826aa2060791d3931”,
“etherUsed”: “fffffffffffffffffffffffffffffff92a7a7de6b5c96e1f4a10c28f16842200”,
“newStorage”: “”,
“message”: “Success!”,
“trace”: “”,
“contractsCreated”: “”
},
“data”: {
“tag”: “Call”,
“contents”: [
[
“Oá*_T²†ô\f-_A›xQªÛ:Æ#|ó(¹Iô\u000bÈß2”
]
]
}
}


#2

I found out it’s ascii encoding.
I was able to use web3.utils.ascciToHex() (https://web3js.readthedocs.io/en/1.0/web3-utils.html#asciitohex) to decode the string into the expected value