title: Reading csv-file in Python containing undefined characters
body: <p>I am reading a CSV-file (ANSI) on my Windows-machine in Python using this code:</p>
  
  <pre><code>import csv
  with open('ttest.dat') as csvDataFile:
      csvReader = csv.reader(csvDataFile, delimiter="\t")
      for i in csvReader:
          print(i)
  </code></pre>
  
  <p>However, I get the error: <code>UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 4: character maps to &lt;undefined&gt;</code></p>
  
  <p>Upon inspecting the file in Notepad++ (after converting it to UTF-8 encoding in Notepad) I see that the following appears:</p>
  
  <p><a href="https://i.stack.imgur.com/ZN7f5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZN7f5.png" alt="enter image description here"></a></p>
  
  <p>It seems that these characters adjacent to <code>hello</code> are causing the issue. When I remove them manually the file can be read. </p>
  
  <p>Is there a way to load the file in Python while explicitly telling it to disregard these odd characters? Or, alternatively, is there a method  to strip the text from these characters automatically? My file is rather large, so it isn't realistic that I manually look through each line.</p>
  
  <p>Note: In R I can read the file without any issues using <code>read.csv</code></p>