Bugzilla – Attachment 25641 Details for
Bug 11679
Add an ods export choice for reports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11679: FIX encoding in CSV file
Bug-11679-FIX-encoding-in-CSV-file.patch (text/plain), 1.76 KB, created by
Jonathan Druart
on 2014-02-26 12:19:15 UTC
(
hide
)
Description:
Bug 11679: FIX encoding in CSV file
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-26 12:19:15 UTC
Size:
1.76 KB
patch
obsolete
>From 8f6492b3de8abde1700123fa15bd14189995a040 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 26 Feb 2014 13:15:54 +0100 >Subject: [PATCH] Bug 11679: FIX encoding in CSV file > >Previously, the CSV file was not in encoded in utf8 and the csv2ods >command failed with the following error if diacritics existed: > UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 >--- > reports/guided_reports.pl | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 45796f2..1eb12b2 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -19,7 +19,7 @@ > > > use CGI qw/-utf8/; >-use Text::CSV; >+use Text::CSV::Encoded; > use URI::Escape; > use File::Temp; > use C4::Reports::Guided; >@@ -772,7 +772,6 @@ elsif ($phase eq 'Run this report'){ > } > > elsif ($phase eq 'Export'){ >- binmode STDOUT, ':encoding(UTF-8)'; > > # export results to tab separated text or CSV > my $sql = $input->param('sql'); # FIXME: use sql from saved report ID#, not new user-supplied SQL! >@@ -790,8 +789,8 @@ elsif ($phase eq 'Export'){ > } else { > my $delimiter = C4::Context->preference('delimiter') || ','; > my $csv_content = q||; >- my $csv = Text::CSV->new({binary => 1, sep_char => $delimiter}); >- $csv or die "Text::CSV->new({binary => 1}) FAILED: " . Text::CSV->error_diag(); >+ my $csv = Text::CSV::Encoded->new({ encoding_out => 'utf8', 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))) { > $csv_content .= $csv->string(). "\n"; > } else { >-- >1.7.10.4
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 11679
:
25026
|
25049
|
25641
|
26232
|
26234
|
26397
|
26398
|
27681
|
27682
|
27715
|
27716
|
27719
|
27720
|
27721
|
27741
|
27742