title: 'utf-8' codec can't decode byte 0xe2 : invalid continuation byte error
body: <p>I am trying to read all PDF files from a folder to look for a number using regular expression. On inspection, the charset for PDFs is 'UTF-8'.</p>
  
  <p>Throws this error:</p>
  
  <blockquote>
    <p>'utf-8' codec can't decode byte 0xe2 in position 10: invalid
    continuation byte</p>
  </blockquote>
  
  <p>Tried reading in binary mode,
   tried Latin-1 encoding, but it shows all special characters so nothing shows up in search. </p>
  
  <pre><code>import os
  import re
  import pandas as pd
  download_file_path = "C:\\Users\\...\\..\\"
  for file_name in os.listdir(download_file_path):
      try:
          with open(download_file_path + file_name, 'r',encoding="UTF-8") as f:
            s = f.read()
            re_api = re.compile("API No\.\:\n(.*)")
            api = re_api.search(s).group(1).split('"')[0].strip()
            print(api)
      except Exception as e:
          print(e)
  </code></pre>
  
  <p>Expecting to find API number from PDF files</p>