title: Remove non-UTF8 characters from file contents
body: <p>I'm trying to read usernames from a database and if there are non-UTF-8 characters, it throws UnicodeDecodeError. </p>
  
  <p>I'm unsure of what all the non-UTF8 characters are and I'm looking for a solution. </p>
  
  <p>I want to keep special symbols, but just filter out the ones that aren't compatible with UTF-8. <code>³</code> and <code>™</code> (trademark), don't work with UTF-8, they're the only two I know of.</p>
  
  <p>I still want to keep chinese symbols, arabic, etc. That's why I'm using UTF8.</p>
  
  <p>Code:</p>
  
  <pre><code>def is_author_used(author):
          with open("C:\\Users\\Administrator\\Desktop\\authors.txt", 'r', encoding='utf-8') as f:
              content = f.read().splitlines()
          if author in content:
              return True
          return False
  
      def set_author_used(author):
          with open("C:\\Users\\Administrator\\Desktop\\authors.txt", 'a', encoding='utf-8') as f:
              f.write(author + '\r\n')
  </code></pre>