Fixed wrong encodings in exported csv file with multi-byte characters.

(cherry picked from commit a4171b76754f16ccddfa762f4d211c6ad57561a0)
This commit is contained in:
Junichi Satoh 2015-11-23 10:43:21 +09:00
parent d2302fa67c
commit b8b1d666dc
2 changed files with 14 additions and 3 deletions

View File

@ -21,6 +21,13 @@ require_once ("../../include/functions.php");
global $config;
$user_language = get_user_language($config['id_user']);
$l10n = NULL;
if (file_exists ('../languages/' . $user_language . '.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('../languages/'.$user_language.'.mo'));
$l10n->load_tables();
}
// Get data
$type = (string) get_parameter('type', 'csv');
@ -52,6 +59,10 @@ $output_csv = function ($data, $filename) {
header ('Content-Type: text/csv; charset=UTF-8');
header ('Content-Disposition: attachment; filename="'.$filename.'.csv"');
// BOM
if (!$excel_encoding)
print pack('C*',0xEF,0xBB,0xBF);
// Header
// Item / data

View File

@ -1443,7 +1443,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
$excelInput
.prop('name', 'excel_encoding')
.prop('type', 'text')
.prop('value', false);
.prop('value', 0);
$form
.prop('method', 'POST')