title: How to identify/delete non-UTF-8 characters in R
body: <p>When I import a Stata dataset in <strong>R</strong> (using the <code>foreign</code> package), the import sometimes contains characters that are not valid <code>UTF-8</code>. This is unpleasant enough by itself, but it breaks everything as soon as I try to transform the object to <code>JSON</code> (using the <code>rjson</code> package).</p>
  
  <p>How I can identify non-valid-<code>UTF-8</code>-characters in a string and delete them after that?</p>