title: Ruby: Flip characters bits
body: <p>I am simply trying to flip the bits of a character. I can get it into a binary form, but when xoring that data with 0xff it seems to not be giving me what I want.  </p>
  
  <pre><code>bin = "a".unpack("b*")[0].to_i # Will give me the binary value        (10000110)
  flip = bin ^ 0xff              # this will give me 9999889, expecting (01111001)
  </code></pre>
  
  <p>Finally, I want to re-pack it as a "character"... </p>
  
  <p>Any help would be appreciated.</p>