Solidity Web3.js – Convert Solidity Bytes32 to Solidity String in JavaScript

bytes32dapp-developmentsoliditystringweb3js

I have functions which are forced to return a bytes32 object, but then in my webapp I need to reconvert them to a classic string. How can I do that?

Best Answer

Try using the web3.js function web3.toAscii (doc), which might change name to web3.toUtf8 or something similar in the future.