title: How to replace multibyte characters in ruby using gsub?
body: <p>I have a problem with saving records in MongoDB using Mongoid when they contain multibyte characters. This is the string:</p>
  
  <pre><code>a="Chris \xA5\xEB\xAE\xDFe\xA5"
  </code></pre>
  
  <p>I first convert it to BINARY and I then <code>gsub</code> it like this:</p>
  
  <pre><code>a.force_encoding("BINARY").gsub(0xA5.chr,"oo")
  </code></pre>
  
  <p>...which works fine:</p>
  
  <pre><code>=&gt; "Chris oo\xEB\xAE\xDFeoo"
  </code></pre>
  
  <p>But it seems that I can not use the <code>chr</code> method if I use <code>Regexp</code>:</p>
  
  <pre><code>a.force_encoding("BINARY").gsub(/0x....?/.chr,"")
  NoMethodError: undefined method `chr' for /0x....?/:Regexp
  </code></pre>
  
  <p>Anybody with the same issue?</p>
  
  <p>Thanks a lot...</p>