Bugzilla – Attachment 98173 Details for
Bug 24330
When importing patrons from CSV, automatically strip BOM from file if it exists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24330: When importing patrons from CSV, automatically strip BOM from file if it exists
Bug-24330-When-importing-patrons-from-CSV-automati.patch (text/plain), 1.80 KB, created by
Martin Renvoize (ashimema)
on 2020-01-30 15:17:36 UTC
(
hide
)
Description:
Bug 24330: When importing patrons from CSV, automatically strip BOM from file if it exists
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-01-30 15:17:36 UTC
Size:
1.80 KB
patch
obsolete
>From f6115e96f7dfc2d202cc8eb7d6c78f4850a5b125 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 2 Jan 2020 10:30:54 -0500 >Subject: [PATCH] Bug 24330: When importing patrons from CSV, automatically > strip BOM from file if it exists > >We have a partner that exports UTF-8 CSV files, and is experiencing the same thing as the author of this article: https://www.freecodecamp.org/news/a-quick-tale-about-feff-the-invisible-character-cd25cd4630e7/ > >In short, Excel is inserting an invisible UTF-8 character at the start of the file, so that the column name "cardnumber" is actually named "\x{feff}cardnumber", causing "cardnumber" to be blank. > >A simple solution is provided here: https://stackoverflow.com/questions/24390034/remove-bom-from-string-with-perl > >Test Plan: >1) Download the example.csv file >2) Attempt to import it using the patron import tool >3) Note the invalid column name error >4) Apply this patch, restart all the things! >5) Attempt the import again >6) Assuming you have a branchcode MPL and a cataegory code S, the patron should import! > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Yew Chung College Library <library@yccece.edu.hk> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Patrons/Import.pm | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index cb3ba56134..f63d95e316 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -404,6 +404,7 @@ sub prepare_columns { > foreach my $keycol (@csvcolumns) { > # columnkeys don't contain whitespace, but some stupid tools add it > $keycol =~ s/ +//g; >+ $keycol =~ s/^\N{BOM}//; # Strip BOM if exists, otherwise it will be part of first column key > $params->{keycol}->{$keycol} = $col++; > } > >-- >2.20.1
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 24330
:
96762
|
96763
|
96789
|
98156
| 98173