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 8991cf9 commit 9d0eb8e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config_defaults_inc.php
Expand Up @@ -2953,6 +2953,14 @@
*/
$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;


/**
* The threshold required for users to be able to manage configuration of a project.
* This includes workflow, email notifications, columns to view, and others.
Expand Down
5 changes: 5 additions & 0 deletions csv_export.php
Expand Up @@ -78,6 +78,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/Admin_Guide/en-US/Configuration.xml
Expand Up @@ -2439,6 +2439,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 9d0eb8e

Please sign in to comment.