neo-express
neo-express copied to clipboard
Automatically parse String responses
Currently, when a method with a return type of "String" is called in Neo Express, the returned value is displayed in hexadecimal format. For instance, the "symbol" method returns "4c494e4b44" instead of the expected value "LINKD".
To fix this, I suggest adding a feature that automatically converts string return types to UTF-8 before displaying them. This would make it easier for developers to read and interpret the output of methods that return strings.
For instance, the "symbol" method in the contract's manifest specifies that it returns a string, as shown in the code snippet below:
{
"name": "symbol",
"offset": 0,
"parameters": [],
"returntype": "String",
"safe": true
}
However, the current output of the method is in hexadecimal format, which can be difficult to read and interpret:

I suggest that neo-express (and related tools) convert hex to UTF-8, when the method return type is String
If the return value is 2222, then what will be displayed, display "" or \"\"?
If the former, it will make the json error, if the latter, it will lose the meaning of the conversion. I suggest this tool for conversion https://neo.org/converter/index
If the method return type is a string, can't we convert it to utf-8? We don't need the extra quotes. What if we print the result between line breaks?
Its just almost all things in the vm are stored as bytes. It was just a lazy way to display generic data, instead of parsing or validating it. Not checking the contract method return type is the problem.
@lock9 I believe #316 does fix this issue? If so can we close?