Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save colepacak/a66d17c0f310a89772dfa7af3866272c to your computer and use it in GitHub Desktop.
Save colepacak/a66d17c0f310a89772dfa7af3866272c to your computer and use it in GitHub Desktop.
Add UTF-8 BOM for MS Excel
diff --git a/theme/views-data-export-csv-header.tpl.php b/theme/views-data-export-csv-header.tpl.php
index e40a1bf..9fe4424 100644
--- a/theme/views-data-export-csv-header.tpl.php
+++ b/theme/views-data-export-csv-header.tpl.php
@@ -2,5 +2,8 @@
// Print out header row, if option was selected.
if ($options['header']) {
+ // Begin file with UTF-8 BOM.
+ print ("\xEF\xBB\xBF");
+ // Content stream
print implode($separator, $header) . "\r\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment