mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Fixed wrong encodings in exported csv file with multi-byte characters.
(cherry picked from commit a4171b76754f16ccddfa762f4d211c6ad57561a0)
This commit is contained in:
parent
d2302fa67c
commit
b8b1d666dc
@ -21,6 +21,13 @@ require_once ("../../include/functions.php");
|
|||||||
|
|
||||||
global $config;
|
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
|
// Get data
|
||||||
$type = (string) get_parameter('type', 'csv');
|
$type = (string) get_parameter('type', 'csv');
|
||||||
|
|
||||||
@ -51,7 +58,11 @@ $output_csv = function ($data, $filename) {
|
|||||||
// CSV Output
|
// CSV Output
|
||||||
header ('Content-Type: text/csv; charset=UTF-8');
|
header ('Content-Type: text/csv; charset=UTF-8');
|
||||||
header ('Content-Disposition: attachment; filename="'.$filename.'.csv"');
|
header ('Content-Disposition: attachment; filename="'.$filename.'.csv"');
|
||||||
|
|
||||||
|
// BOM
|
||||||
|
if (!$excel_encoding)
|
||||||
|
print pack('C*',0xEF,0xBB,0xBF);
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
|
||||||
// Item / data
|
// Item / data
|
||||||
@ -64,7 +75,7 @@ $output_csv = function ($data, $filename) {
|
|||||||
foreach ($items['data'] as $item) {
|
foreach ($items['data'] as $item) {
|
||||||
$item = str_replace("--> ".__('Selected'),'',$item);
|
$item = str_replace("--> ".__('Selected'),'',$item);
|
||||||
$line = implode($separator, $item);
|
$line = implode($separator, $item);
|
||||||
|
|
||||||
if ($excel_encoding)
|
if ($excel_encoding)
|
||||||
echo mb_convert_encoding($line, 'UTF-16LE', 'UTF-8') . "\n";
|
echo mb_convert_encoding($line, 'UTF-16LE', 'UTF-8') . "\n";
|
||||||
else
|
else
|
||||||
|
@ -1443,7 +1443,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
$excelInput
|
$excelInput
|
||||||
.prop('name', 'excel_encoding')
|
.prop('name', 'excel_encoding')
|
||||||
.prop('type', 'text')
|
.prop('type', 'text')
|
||||||
.prop('value', false);
|
.prop('value', 0);
|
||||||
|
|
||||||
$form
|
$form
|
||||||
.prop('method', 'POST')
|
.prop('method', 'POST')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user