read a file and try to remove all non UTF-8 chars
<p>I am trying to read a file and convert the string to a <code>UTF-8</code> string, in order to remove some non <code>utf-8</code> chars in the file string,</p>

<pre><code>file_str = open(file_path, 'r').read()
file_str = file_str.decode('utf-8')
</code></pre>

<p>but I got the following error,</p>

<pre><code>AttributeError: 'str' object has no attribute 'decode'
</code></pre>

<p>Update: I tried the code as suggested by the answer,</p>

<pre><code>file_str = open(file_path, 'r', encoding='utf-8').read()
</code></pre>

<p>but it didn't eliminate the non <code>utf-8</code> chars, so how to remove them? </p>