title: Mysql and excel csv file
body: <p>i have a php script that has to compare some words in a csv file to a mysql table element. The problem is that apparently the csv file is'nt created in the correct codification.</p>
  
  <p>The first error is this:
  <strong><em>SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (latin1_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'</em></strong></p>
  
  <p>Now when i use <code>utf_encode</code> on the variable, the error goes away but it didnt find my variable int the mysql database.</p>
  
  <p>To be clear, i have several accented words in my csv file, and i can´t change thhis.</p>
  
  <p>i'm using <strong>latin1</strong> charset and <strong>latin1_general_ci</strong> collation in my DB.</p>
  
  <p>Another observation is that i'm using thw following code to get information in the file:</p>
  
  <pre><code>if (($handle = @fopen("../arquivos/atualização/$name", "r")) !== FALSE) {
  while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
  </code></pre>
  
  <p>Can i somehow convert my csv file in php without losing the accents? or convert my db tables? </p>
  
  <p>Note: in notepad++ my CSV file is in ANSI codification, and when i convert it to utf the accents turn into strange characters.</p>