title: Sanitizing strings with (intentionally) difficult characters
body: <p>I have a program that parses user input.  I was getting errors relating to \0000 in the unicode string (<code>unsupported Unicode escape sequence</code>), so I did some investigation and found:</p>
  
  <p><code>A_real_string_\x03\x04\x00\x06\x00\x03\x08\t\x01\x03 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd</code></p>
  
  <p>I would like to remove things like this (particularly <code>\x00</code>) from the string without dropping support for international characters.  What's a good approach?</p>
  
  <p>Edit: I think what I would really like to do is remove the \x00 and everything after it.  How could I do that?</p>