title: UnicodeDecodeError exception from reading xml file
body: <p>I tried to parse xml with BeautifulSoup</p>
  <pre><code>    content = open(filename, encoding='utf-8').read()
      return BeautifulSoup(content)
  </code></pre>
  <p>And check the source file's codec, it told me it should be ascii</p>
  <pre><code>➜  worker git:(develop) ✗ chardetect ../complete_data/sample.xml                                                                    git:(develop|✚9…
  ../complete_data/sample.xml: ascii with confidence 1.0
  </code></pre>
  <p>However, it still breaks my program with exception,</p>
  <p>How could I fix it, furthermore, how could I know the correct encoding in the future, and the exception message from Python is so poor</p>
  <h1>Exception</h1>
  <pre><code>Traceback (most recent call last):
    File &quot;parser_factory.py&quot;, line 97, in &lt;module&gt;
      test_shareholder_meetings()
    File &quot;parser_factory.py&quot;, line 81, in test_shareholder_meetings
      _import_source_files(collection_name=&quot;shareholder_meetings&quot;, dataset_name=&quot;WSH_BoD_Shareholder&quot;)
    File &quot;parser_factory.py&quot;, line 78, in _import_source_files
      parser(f, collection_name).import_data()
    File &quot;/workspace/balala-wsh/worker/parser_base.py&quot;, line 21, in __init__
      self.soup = self.read_file_in_bs(filename)
    File &quot;/workspace/balala-wsh/worker/parser_base.py&quot;, line 30, in read_file_in_bs
      content = open(filename, encoding='utf-8').read()
    File &quot;/Users/sample_user/.pyenv/versions/3.4.3/lib/python3.4/codecs.py&quot;, line 319, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 180145: invalid continuation byte
  </code></pre>