From: Ryan Davis Date: 2011-02-23T19:25:09+09:00 Subject: Re: Monkey patching class String to add bitwise operators On Feb 23, 2011, at 02:12 , Martin Hansen wrote: > <"00110001"> expected but was > <"\x00\x00\x01\x01\x00\x00\x00\x01">. The first are composed of the chars "0" and "1" (ascii 48/49). The second are actual ones and zeros (ascii 0/1): % ruby19 -e 'p "\x00\x00\x01\x01\x00\x00\x00\x01".split(//).map(&:ord)' [0, 0, 1, 1, 0, 0, 0, 1] The problem probably lies with your use of ord w/o chr.