diff --git a/config_defaults_inc.php b/config_defaults_inc.php index a894e3b658..66fedcd50d 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -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. diff --git a/csv_export.php b/csv_export.php index 3bc309919d..e4823ca51d 100644 --- a/csv_export.php +++ b/csv_export.php @@ -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(); diff --git a/docbook/Admin_Guide/en-US/Configuration.xml b/docbook/Admin_Guide/en-US/Configuration.xml index 8165545cdf..0aace4418f 100644 --- a/docbook/Admin_Guide/en-US/Configuration.xml +++ b/docbook/Admin_Guide/en-US/Configuration.xml @@ -2439,6 +2439,14 @@ + + $g_csv_add_bom + + 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; + + +