title: How do I remove non UTF-8 characters from a String?
body: <p>I need to remove non UTF-8 characters from a string. Here is the snap of the text.</p>
  
  <p><a href="https://i.stack.imgur.com/RmtYp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RmtYp.png" alt="enter image description here"></a></p>
  
  <p>This is how it looks like when I open the string in NPP, and then set the encoding to UTF-8:</p>
  
  <p><a href="https://i.stack.imgur.com/PHSSe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PHSSe.png" alt="enter image description here"></a></p>
  
  <p>I think the <code>ACK</code> and <code>FF</code> are non UTF-8 characters.</p>
  
  <p>I tried <code>str.scrub</code> as well as <code>str.encode</code>. Neither of them seems to work. <code>scrub</code> returns the same result, and <code>encode</code> results in an error.</p>