title: Remove non UTF-8 characters from an XML file, using sed
body: <p>A given XML file with UTF-8 declared as the encoding does not pass <code>xmllint</code>. With the assumption that a non UTF-8 character is causing the error, the following <code>sed</code> command is being run against the file. <code>sed 's/[^\x00-\x7F]//g' file.xml</code>. Either the command is wrong, or non UTF-8 characters are not the problem, as <code>xmllint</code> still fails after running the <code>sed</code>. The first question is: does the <code>sed</code> regex appear correct?</p>
  
  <p>= = = = =</p>
  
  <p>Here is the output of <code>xmllint</code>:
  <code>
  $ xmllint file.xml
  file.xml:35533: parser error : CData section not finished
  &lt;p class="imgcont"&gt;&lt;img alt="Diets of 2013" src="h
  &lt;b&gt;What You Eat: &lt;/b&gt;Foods low in sugar and carbs and high in fat—80% of cal
                                                                    ^
  file.xml:35533: parser error : PCDATA invalid Char value 31
  &lt;b&gt;What You Eat: &lt;/b&gt;Foods low in sugar and carbs and high in fat—80% of cal
                                                                    ^
  file.xml:35588: parser error : Sequence ']]&gt;' not allowed in content
  as.people.com/2013/11/07/kerry-washington-pregnant-diet-green-smoothie-recipe/"]
                                                                                 ^
  </code></p>
  
  <p>= = = = =</p>
  
  <p><strong>UPDATE:</strong> In TextMate, on viewing the file, there is a character that is being shown as <code>&lt;US&gt;</code>. If that character is manually deleted from the file, the file then passes <code>xmllint</code>.</p>