title: How to Decode Scrambled Character Encoding: Special Character Encoding
body: <p>I have data in CSV format that has been seriously scrambled character encoding wise, likely going back and forth between different software applications (LibreOffice Calc, Microsoft, Excel, Google Refine, custom PHP/MySQL software; on Windows XP, Windows 7 and GNU/Linux machines from various regions of the world...). It seems like somewhere in the process, non-ASCII characters have become seriously scrambled, and I'm not sure how to descramble them or detect a pattern. To do so manually would involve a few thousand records...</p>
  
  <p>Here's an example. For "Trois-Rivières", when I open this portion of the CSV file in Python, it says:</p>
  
  <pre><code>Trois-Rivi\xc3\x83\xc2\x85\xc3\x82\xc2\xa0res
  </code></pre>
  
  <p>Question: through what process can I reverse</p>
  
  <pre><code>\xc3\x83\xc2\x85\xc3\x82\xc2\xa0
  </code></pre>
  
  <p>to get back</p>
  
  <pre><code>è
  </code></pre>
  
  <p>i.e. how can I unscramble this? How might this have become scrambled in the first place? How can I reverse engineer this bug?</p>