# HG changeset patch
# User enboig
# Date 1298973535 -3600
# Node ID 5ed5e41c241a5844d2e12ebf672a42124df84fd2
# Parent  fa73b8d4915b4c209ee9d37ff3600866b1be4f48
* added ANSI support

diff --git a/plugins/views_data_export_plugin_style_export_csv.inc b/plugins/views_data_export_plugin_style_export_csv.inc
--- a/plugins/views_data_export_plugin_style_export_csv.inc
+++ b/plugins/views_data_export_plugin_style_export_csv.inc
@@ -32,6 +32,11 @@
       'default' => TRUE,
       'translatable' => FALSE,
     );
+    $options['encoding'] = array(
+      'default' => 'utf8',
+      'translatable' => FALSE,
+    );
+
 
     return $options;
   }
@@ -70,5 +75,14 @@
       '#title' => t('Make first row a list of column headers.'),
       '#default_value' => !empty($this->options['header']),
     );
+    $form['encoding'] = array(
+      '#type' => 'radios',
+      '#default_value' => (empty($this->options['encoding']) ? 'utf8' : $this->options['encoding']),
+      '#title' => t('Codification of the output file'),
+      '#options' => array (
+        'utf8' => 'UTF-8',
+        'ansi' => 'ANSI',
+      ),
+    );
   }
 }
diff --git a/theme/views_data_export.theme.inc b/theme/views_data_export.theme.inc
--- a/theme/views_data_export.theme.inc
+++ b/theme/views_data_export.theme.inc
@@ -107,6 +107,13 @@
     if ($vars['options']['trim']) {
       $output = trim($output);
     }
+    switch($vars['options']['encoding']) {
+      case 'ansi':
+        $output = utf8_decode($output);
+        break;
+      case 'utf8':
+        break;
+    }
     $vars['header'][$key] = $wrap . str_replace('"', $replace_value, $output) . $wrap;
   }
 }
@@ -139,6 +146,13 @@
       if ($vars['options']['trim']) {
         $output = trim($output);
       }
+      switch($vars['options']['encoding']) {
+        case 'ansi':
+          $output = utf8_decode($output);
+          break;
+        case 'utf8':
+          break;
+      }
       $vars['themed_rows'][$i][$j] = $wrap . str_replace('"', $replace_value, $output) . $wrap;
     }
   }
