13

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?

eth
  • 85,679
  • 53
  • 285
  • 406
arodriguezdonaire
  • 3,027
  • 3
  • 20
  • 37

2 Answers2

15

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

MrChico
  • 1,786
  • 14
  • 19
  • I see at the top of the documentation that these features are not yet released. Are these features still not released or is the documentation out of date?

    https://web3js.readthedocs.io/en/1.0/web3-utils.html

    – Jonathan Scialpi Sep 06 '18 at 10:52
1

In version 1.0 of web3 js use the new utils function

web3.utils.hexToAscii('0x4920686176652031303021')

doc

philip_nunoo
  • 111
  • 2