user3686276
user3686276

Reputation: 35

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.

Upvotes: 1

Views: 1660

Answers (3)

aftrix
aftrix

Reputation: 81

Drupal 8 and Drupal 9, Unicode signature can be included in format settings Format settings > CSV Settings

Upvotes: 0

user-pj
user-pj

Reputation: 28

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

Upvotes: 1

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522539

You need to choose the proper encoding in the Excel import dialog. For example, I saved the following sample data into a CSV file:

Gürhan Bakırküre, 1
Tim Biegeleisen, 2

I saved the file as UTF-8, since I do not know the exact encoding of your actual data. During the import process in Excel, I made sure to also select the same UTF-8 encoding as shown in this screen capture:

enter image description here

The text rendered in Excel correctly with no problems. You should probably find out what exact encoding your original file is and use that when you import.

Upvotes: 0

Related Questions