title: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 359: invalid start byte
body: <p>First time poster, bear with me...</p>
  
  <pre><code>#!/usr/bin/python
  import sys, os
  count = 0
  filename = "data2.txt"
  file = open(filename, "r")
  
  
  s1 = input("What do you want to search for? ")
  search = s1.lower()
  
  words = search.split()
  
  def restart_program():
      """Restarts the current program.
      Note: this function does not return. Any cleanup action (like
      saving data) must be done before calling this function."""
      python = sys.executable
      os.execl(python, python, * sys.argv)
  
  def countlines():  #count length of file
      with open(filename, 'r') as f:
          count = 0
          for line in f:
              count += 1
          return count
  total = countlines()
  totp1 = total + 1
  
  with open(filename) as f:
    currpos = 0
    for line in f:
      currpos += 1
      line2 = line.lower()
      if currpos &lt; totp1:
        if len(search.split()) == 2:
          if line2.find(words[0]) != -1 and line2.find(words[1]) != -1:
            print(line)
        if len(search.split()) == 1:
          if line2.find(search) != -1:
            print(line)
            #restart_program()
        if search == "quit":
          print('Exiting')
          break
        if search == "exit":
          print('Exiting')
          break
      if currpos == total:
        restart_program()
  </code></pre>
  
  <p>When I run this code on Repl.it it runs without issue and does just what its supposed to do.  However when I run it on my laptop (Arch) I get this error:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "./search", line 23, in &lt;module&gt;
      total = countlines()
    File "./search", line 20, in countlines
      for line in f:
    File "/usr/lib/python3.8/codecs.py", line 322, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 359: invalid start byte
  </code></pre>
  
  <p>Any Help appreciated.  If in missed any required details just ask.  Thank you!</p>