Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4fd5356

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 9781b61 commit 4fd5356

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
 

‎config_defaults_inc.php

+7
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,13 @@
27012701
*/
27022702
$g_csv_separator = ',';
27032703

2704+
/**
2705+
* CSV Export
2706+
* Add Byte Order Mark (BOM) at the begining of the file as it helps Excel display the file in UTF-8
2707+
* @global string $g_csv_add_bom
2708+
*/
2709+
$g_csv_add_bom = OFF;
2710+
27042711
/**
27052712
* threshold for users to view the system configurations
27062713
* @global int $g_view_configuration_threshold

‎csv_export.php

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
# Get columns to be exported
6464
$t_columns = csv_get_columns();
6565

66+
# export BOM
67+
if ( config_get( 'csv_add_bom' ) == ON ) {
68+
echo "\xEF\xBB\xBF";
69+
}
70+
6671
# export the titles
6772
$t_first_column = true;
6873
ob_start();

‎docbook/adminguide/en/configuration.sgml

+8
Original file line numberDiff line numberDiff line change
@@ -2336,6 +2336,14 @@
23362336
</para>
23372337
</listitem>
23382338
</varlistentry>
2339+
<varlistentry>
2340+
<term>$g_csv_add_bom</term>
2341+
<listitem>
2342+
<para>Add Byte Order Mark (BOM) at the begining of the file as it helps Excel display the file in UTF-8.
2343+
The default value is OFF;
2344+
</para>
2345+
</listitem>
2346+
</varlistentry>
23392347
</variablelist>
23402348
</section>
23412349

0 commit comments

Comments
 (0)
Please sign in to comment.