Bugzilla – Attachment 25629 Details for
Bug 11811
tools/import_borrowers.pl doesn't support utf-8 encoded CSV
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 11811 - tools/import_borrowers.pl doesn't support utf-8 encoded CSV
SIGNED-OFF-Bug-11811---toolsimportborrowerspl-does.patch (text/plain), 1.96 KB, created by
Mark Tompsett
on 2014-02-26 06:26:52 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 11811 - tools/import_borrowers.pl doesn't support utf-8 encoded CSV
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2014-02-26 06:26:52 UTC
Size:
1.96 KB
patch
obsolete
>From 261f3779a11960c34fe265d356b86441056a073b Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Fri, 21 Feb 2014 13:56:11 +0100 >Subject: [PATCH] [SIGNED OFF] Bug 11811 - tools/import_borrowers.pl doesn't > support utf-8 encoded CSV > >Decode utf-8 characters in CSV file > >Test scenario: >1. go to Tools > Import patrons >2. download sample CSV file >3. create few patrons with utf-8 chars >4. import patrons and verify then utf-8 characters are correct > >Importing patrons was tested once on master and modified for >a test on the patch. The diacritics showed up as expected. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > tools/import_borrowers.pl | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl >index 5f65c97..aa26bce 100755 >--- a/tools/import_borrowers.pl >+++ b/tools/import_borrowers.pl >@@ -48,12 +48,9 @@ use C4::Members::AttributeTypes; > use C4::Members::Messaging; > > use Text::CSV; >-# Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals: >-# Ä >-# Ä >+use utf8; > > use CGI; >-# use encoding 'utf8'; # don't do this > > my (@errors, @feedback); > my $extended = C4::Context->preference('ExtendedPatronAttributes'); >@@ -115,6 +112,7 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { > > # use header line to construct key to column map > my $borrowerline = <$handle>; >+ utf8::decode($borrowerline); > my $status = $csv->parse($borrowerline); > ($status) or push @errors, {badheader=>1,line=>$., lineraw=>$borrowerline}; > my @csvcolumns = $csv->fields(); >@@ -138,6 +136,7 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { > my $date_re = C4::Dates->new->regexp('syspref'); > my $iso_re = C4::Dates->new->regexp('iso'); > LINE: while ( my $borrowerline = <$handle> ) { >+ utf8::decode($borrowerline); > my %borrower; > my @missing_criticals; > my $patron_attributes; >-- >1.7.9.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 11811
:
25616
|
25628
|
25629
|
26059
|
26060
|
26102
|
26375
|
27099