Bugzilla – Attachment 25616 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]
Bug 11811 - tools/import_borrowers.pl doesn't support utf-8 encoded CSV
Bug-11811---toolsimportborrowerspl-doesnt-support-.patch (text/plain), 1.78 KB, created by
Dobrica Pavlinusic
on 2014-02-25 11:45:50 UTC
(
hide
)
Description:
Bug 11811 - tools/import_borrowers.pl doesn't support utf-8 encoded CSV
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2014-02-25 11:45:50 UTC
Size:
1.78 KB
patch
obsolete
>From 5f1880b01bf33c19ef043270e6ada86dd930f78f Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Fri, 21 Feb 2014 13:56:11 +0100 >Subject: [PATCH] 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 >--- > tools/import_borrowers.pl | 7 +++---- > 1 files 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.2.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