title: Why do I get latin-1 codec error with a Utf8 script, unicode data, and utf8 database?
body: <p>I have a problem with my python 2.7 script. Script is declared in UTF8, the Data I get from Google Search Console API are in Unicode, and the Database where I want to store them is in UTF8 too (UTF-8 Unicode utf8mb4, utf8mb4_general_ci).</p>
  
  <p>If I launch the script on my mac (and store the data on my physical ubuntu server, no problem at all.
  If I launch the same script, directly from the server or on my mac through SSH, I get a latin-1 codec error.</p>
  
  <p>I triple checked locale variable on both server and my mac, I get exactly the same values which are : </p>
  
  <pre><code>LANG=fr_FR.UTF-8
  LANGUAGE=
  LC_CTYPE="fr_FR.UTF-8"
  LC_NUMERIC="fr_FR.UTF-8"
  LC_TIME="fr_FR.UTF-8"
  LC_COLLATE="fr_FR.UTF-8"
  LC_MONETARY="fr_FR.UTF-8"
  LC_MESSAGES="fr_FR.UTF-8"
  LC_PAPER="fr_FR.UTF-8"
  LC_NAME="fr_FR.UTF-8"
  LC_ADDRESS="fr_FR.UTF-8"
  LC_TELEPHONE="fr_FR.UTF-8"
  LC_MEASUREMENT="fr_FR.UTF-8"
  LC_IDENTIFICATION="fr_FR.UTF-8"
  LC_ALL=fr_FR.UTF-8
  </code></pre>
  
  <p>Encoding of the Ubuntu terminal is in UTF8 two ..</p>
  
  <p>I don't have any idea why my script want to store the data in latin-1 because it is unicode and the base is in utf8. Also, if I specify <code>data.encode('utf-8')</code>, the script works but data are not correctly encoded..</p>
  
  <p>Any idea ?</p>
  
  <p>For information, I use the library "Dataset" to make MYSQL requests, so I can't specify any charset anywhere I think.</p>