Skip to content

Commit 9d0eb8e

Browse files
VeMagrombert
authored andcommittedDec 23, 2011
Fix #0009034: CSV Export with special chars dont work properly
Adding "Byte Order Mark" at the begining of the file resolves the issue. $g_csv_add_bom parameter with default = OFF, because of remarks on pull request 27 Signed-off-by: Robert Munteanu <robert.munteanu@gmail.com>
1 parent 8991cf9 commit 9d0eb8e

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
 

‎config_defaults_inc.php

+8
Original file line numberDiff line numberDiff line change
@@ -2953,6 +2953,14 @@
29532953
*/
29542954
$g_csv_separator = ',';
29552955

2956+
/**
2957+
* CSV Export
2958+
* Add Byte Order Mark (BOM) at the begining of the file as it helps Excel display the file in UTF-8
2959+
* @global string $g_csv_add_bom
2960+
*/
2961+
$g_csv_add_bom = OFF;
2962+
2963+
29562964
/**
29572965
* The threshold required for users to be able to manage configuration of a project.
29582966
* This includes workflow, email notifications, columns to view, and others.

‎csv_export.php

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@
7878
# Get columns to be exported
7979
$t_columns = csv_get_columns();
8080

81+
# export BOM
82+
if ( config_get( 'csv_add_bom' ) == ON ) {
83+
echo "\xEF\xBB\xBF";
84+
}
85+
8186
# export the titles
8287
$t_first_column = true;
8388
ob_start();

‎docbook/Admin_Guide/en-US/Configuration.xml

+8
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,14 @@
24392439
</para>
24402440
</listitem>
24412441
</varlistentry>
2442+
<varlistentry>
2443+
<term>$g_csv_add_bom</term>
2444+
<listitem>
2445+
<para>Add Byte Order Mark (BOM) at the begining of the file as it helps Excel display the file in UTF-8.
2446+
The default value is OFF;
2447+
</para>
2448+
</listitem>
2449+
</varlistentry>
24422450
</variablelist>
24432451
</section>
24442452

0 commit comments

Comments
 (0)
Please sign in to comment.