title: UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 668: character maps to <undefined>
body: <p>I downloaded file and file is OK in excel, but in notepad it's  format is wrong </p>
  
  <p>I spent a lot of time, but can't solve error</p>
  
  <p>Link to file <a href="https://drive.google.com/open?id=1TDh81zdOggOexdaTxeiGz7r7jSkVqLEG" rel="nofollow noreferrer">https://drive.google.com/open?id=1TDh81zdOggOexdaTxeiGz7r7jSkVqLEG</a></p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>#to support encodings
  # -*- coding: utf-8 -*-
  
  import codecs
  
  path = "badcode.xlsx"
  
  #read input file
  with codecs.open(path, 'r', encoding = 'cp1251') as file:
    lines = file.read()
  
  #write output file
  with codecs.open(path, 'w', encoding = 'utf8') as file:
    file.write(lines)
  </code></pre>
  
  <p>I have error:</p>
  
  <blockquote>
    <p>UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 668: character maps to </p>
  </blockquote>
  
  <p><strong>What I did</strong>:</p>
  
  <pre><code>path = "badcode.xlsx"
  with open(path) as f:
      print(f)
  </code></pre>
  
  <p>Returns</p>
  
  <blockquote>
    <p>&lt;_io.TextIOWrapper name='badcode.xlsx' mode='r' encoding='cp1251'></p>
  </blockquote>