title: Special characters encoding during CSV import
body: <p>I have script that read *.CSV file and then export it content to MSSQL Database. Script is running only via CLI. </p>
  
  <p>My problem is that this CSV file contains string with national characters like <code>ą,ó,ż,ź,ś</code>. For example i have word <code>pracowników</code> but in CLI i see word <code>pracownikˇw</code>.</p>
  
  <p><strong>My code</strong></p>
  
  <pre><code>$handler = fopen($file, "r");
          if ($handler !== false) {
              while (($this-&gt;currentRow = fgetcsv($handler, 0, $this-&gt;csvDelimiter)) !== false) {
  
                  $row = $this-&gt;setHeaders(
                      $this-&gt;currentRow,
                      $this-&gt;config[$type]['columnMapping']
                  );
  
                  if ($row !== false) {
                      $this-&gt;dataImported[$type][] = $row;
                  }
              }
  
              fclose($handler);
          }
  </code></pre>
  
  <p><strong>What i tried</strong></p>
  
  <ul>
  <li>Using <code>fgetcsv</code> with <code>setlocale</code> or without - not working.</li>
  <li>Replace <code>fgetcsv</code> with <code>fgets</code> and read each line via <code>str_getcsv</code> - not working.</li>
  <li>Using <code>utf8_encode</code> for each row - not working.</li>
  </ul>
  
  <p><strong>Additional info</strong></p>
  
  <ul>
  <li>According to my PHP (PHP5.3) and few editors this file is encoded in <code>ANSII</code>, i tried to decoded it with <code>iconv</code> but all special characters are always replace with some strange symbols, like showed before.</li>
  </ul>