Bugzilla – Attachment 171677 Details for
Bug 33635
CSV export display broken diacritics in Excel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33635: Add BOM to report exports as CSV
Bug-33635-Add-BOM-to-report-exports-as-CSV.patch (text/plain), 1.32 KB, created by
PTFS Europe Sandboxes
on 2024-09-18 14:34:19 UTC
(
hide
)
Description:
Bug 33635: Add BOM to report exports as CSV
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2024-09-18 14:34:19 UTC
Size:
1.32 KB
patch
obsolete
>From 4c063d6b0148328e2fc937a3580319cc7943d982 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 18 Sep 2024 05:42:41 +0100 >Subject: [PATCH] Bug 33635: Add BOM to report exports as CSV > >When you export a report as CSV excel will not recognise that it's >encoding is utf-8 unless there is a correct Byte Order Mark prepended to >the file. > >This patch adds such a BOM to the output file allowing Excel to treat >the file correctly. > >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >--- > reports/guided_reports.pl | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 49687d3988..38d5552270 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -646,6 +646,10 @@ elsif ($op eq 'export'){ > if ( $format eq 'csv' ) { > my $delimiter = C4::Context->csv_delimiter; > $type = 'application/csv'; >+ >+ # Add BOM for UTF-8 encoded CSV >+ $content .= "\xEF\xBB\xBF"; >+ > my $csv = Text::CSV::Encoded->new({ encoding_out => 'UTF-8', sep_char => $delimiter}); > $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag(); > if ( $csv->combine( header_cell_values($sth) ) ) { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33635
:
171650
|
171677
|
171837