Text to Binary and Back Conversion in Ruby -


i have string placed array , turned binary using .pack('b*'). how convert binary data string? .unpack('h*') not solution here, returns string of gibberish.

i have tried in rails console , got following. hope you.

a = "hello".unpack("b*")  ## output ["0100100001100101011011000110110001101111"]  a.pack("b*")  ## output "hello"  = "hello".unpack("h*")  ## output ["48656c6c6f"]  a.pack("h*")  ## output "hello" 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -