Skip to content

Commit

Permalink
Fix #0009034: CSV Export with special chars dont work properly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
VeMag authored and rombert committed Dec 23, 2011
1 parent 9781b61 commit 4fd5356
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config_defaults_inc.php
Expand Up @@ -2701,6 +2701,13 @@
*/
$g_csv_separator = ',';

/**
* CSV Export
* Add Byte Order Mark (BOM) at the begining of the file as it helps Excel display the file in UTF-8
* @global string $g_csv_add_bom
*/
$g_csv_add_bom = OFF;

/**
* threshold for users to view the system configurations
* @global int $g_view_configuration_threshold
Expand Down
5 changes: 5 additions & 0 deletions csv_export.php
Expand Up @@ -63,6 +63,11 @@
# Get columns to be exported
$t_columns = csv_get_columns();

# export BOM
if ( config_get( 'csv_add_bom' ) == ON ) {
echo "\xEF\xBB\xBF";
}

# export the titles
$t_first_column = true;
ob_start();
Expand Down
8 changes: 8 additions & 0 deletions docbook/adminguide/en/configuration.sgml
Expand Up @@ -2336,6 +2336,14 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$g_csv_add_bom</term>
<listitem>
<para>Add Byte Order Mark (BOM) at the begining of the file as it helps Excel display the file in UTF-8.
The default value is OFF;
</para>
</listitem>
</varlistentry>
</variablelist>
</section>

Expand Down

0 comments on commit 4fd5356

Please sign in to comment.