From 981675683599699a9a35f74250abe47917a946a9 Mon Sep 17 00:00:00 2001
From: AhmadZain <iahmadzain@icloud.com>
Date: Thu, 22 Dec 2016 21:35:48 +0200
Subject: [PATCH] Issue #1701018 by somersoft, dasha_v, bkonetzny,
 stockliasteroid, AhmadZain: CSV export UTF-8 & windows - BOM

---
 plugins/views_data_export_plugin_style_export.inc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/plugins/views_data_export_plugin_style_export.inc b/plugins/views_data_export_plugin_style_export.inc
index 8d7eed6..f1e2dd7 100644
--- a/plugins/views_data_export_plugin_style_export.inc
+++ b/plugins/views_data_export_plugin_style_export.inc
@@ -236,6 +236,13 @@ class views_data_export_plugin_style_export extends views_plugin_style {
     $rows = array();
     $title = '';
     $output = '';
+    if ($this instanceof views_data_export_plugin_style_export_csv) {
+      $encoding = $this->options['encoding'];
+      if (empty($encoding) || ($encoding != 'ASCII')) {
+        $output = chr(0xEF).chr(0xBB).chr(0xBF);
+      }
+    }
+
     $output .= theme($this->theme_functions($this->definition['additional themes base'] . '_header'), array('view' => $this->view, 'options' => $this->options, 'rows' => $rows, 'title' => $title));
     return $output;
   }
-- 
2.10.1 (Apple Git-78)

