title: UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9: invalid continuation byte
body: <p>I am reading the text file using the following code.</p>
  
  <pre><code>df = pd.read_csv(file_path, sep='\"\|\"', keep_default_na=False, quotechar="~", engine='python', encoding='ISO-8859-1').applymap(str).applymap(lambda x: x.strip("\""))
  </code></pre>
  
  <p>Now I need to write into another text file changing the separator. So I am using the below code to write to text file.</p>
  
  <pre><code>df.to_csv(file_path, sep=',', header=None, index=False,quoting=csv.QUOTE_NONE, encoding='ISO-8859-1')
  </code></pre>
  
  <p>While writing to file I am getting the below error. I tried changing to different encoding. Nothing worked. can someone help me.</p>
  
  <pre><code>File "C:\Users\ss\PycharmProjects\RepoGeneration\venv\lib\site-packages\pandas\core\frame.py", line 1524, in to_csv
  formatter.save()
  File "C:\Users\ss\PycharmProjects\RepoGeneration\venv\lib\site-packages\pandas\io\formats\format.py", line 1652, in save
  self._save()
  File "C:\Users\ss\PycharmProjects\RepoGeneration\venv\lib\site-packages\pandas\io\formats\format.py", line 1754, in _save
  self._save_chunk(start_i, end_i)
  File "C:\Users\ss\PycharmProjects\RepoGeneration\venv\lib\site-packages\pandas\io\formats\format.py", line 1780, in _save_chunk
  lib.write_csv_rows(self.data, ix, self.nlevels, self.cols, self.writer)
  File "pandas\_libs\lib.pyx", line 1052, in pandas._libs.lib.write_csv_rows
  File "C:\Users\ss\PycharmProjects\RepoGeneration\venv\lib\site-packages\pandas\io\common.py", line 555, in writerows
  data = data.decode("utf-8")
  File "C:\Users\ss\PycharmProjects\RepoGeneration\venv\lib\encodings\utf_8.py", line 16, in decode
  return codecs.utf_8_decode(input, errors, True)
  UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 3304: invalid continuation byte
  </code></pre>