exceldrupalunicodedrupal-viewsexport-to-csv

How to convert special characters in CSV when opened with Microsoft Excel


I have the text with special characters like "Gürhan Bakırküre" but when i export this as CSV and opened with excel it was showing as "Gürhan Bakırküre".

I am exporting the text using drupal data export view.


Solution

  • May be below link can help you - http://www.jpstacey.info/blog/2015-05-04/unicode-accented-characters-drupal-views-data-export-and-excel.

    In a nutsehll, jus follow below instructions-

    Copy views-data-export-csv-header.tpl.php to site's custom theme, and add a single executable line (print "\xEF\xBB\xBF";) to write the BOM:

    <?php
    
    // Print out header row, if option was selected.
    if ($options['header']) {
      // Begin file with UTF-8 BOM.
      print "\xEF\xBB\xBF";
      // Now continue to output header as normal.
      print implode($separator, $header) . "\r\n";
    }
    

    Thanks