title: Python Can't Read Corrupted XML
body: <p>I have a bunch of XML files that have been corrupted. Within them is still some uncorrupted data. Here is a picture of what I am talking about: </p>
  
  <p><img src="https://i.stack.imgur.com/WzSWZ.jpg" alt="Screenshot"></p>
  
  <p>I want to iterate through each of the files with python and grab the un-corrupted data, but when I open the file with python:</p>
  
  <pre><code>i2 = open(x + '/' + i, 'r')
  </code></pre>
  
  <p>It opens the file, but when I try to read through it, it comes back to me saying that only this was  read from the file:</p>
  
  <pre><code>'\xa8\x9f\xb0\xdb\x17\xa1\t&amp;}4U\xccsr\xcfN\x7fS\xa1C\xb5\xa4\xd6a\x84i'
  </code></pre>
  
  <p>I've tried a few different encodings, but it keeps coming back with an error:</p>
  
  <pre><code>i2 = open(x + '/' + i, 'r', encoding='utf8')
  i2 = open(x + '/' + i, 'r', encoding='ANSI')
  </code></pre>
  
  <p>Please let me know if you know why Python is not reading this file correctly.</p>