title: XOR encode a multibyte string and save to MySQL field without loss
body: <p>I'm currently using <a href="https://stackoverflow.com/a/7548861/266561">this function</a> to obfuscate a bit the field values in MySQL and protect it from direct dumping. It all works good and values are stored correctly, but what happens when i try to <strong>store a multibyte string</strong>?</p>
  
  <p>Here's an example, let's try to encode the string <em>álex</em>:</p>
  
  <pre><code>&lt;?
  $v = xorencode('álex');
  // step 1 - encode
  echo $v."\n";
  // step 2 - decode
  echo xorencode($v);
  ?&gt;
  </code></pre>
  
  <p>Works good, i see some obfuscated string first time, and then i see <em>álex</em> again. Now if i try to save it in a <strong>VARCHAR</strong> field in a MySQL table, and then select it - i no longer have a utf string, instead it gets returned as <em>gllex</em>.</p>
  
  <p>Note, MySQL tables and fields collations are utf8_general_ci, files are UTF-8, and i <code>SET NAMES utf8</code> after connecting. Any workaround to this?</p>
  
  <p>Thanks</p>