[Koha-bugs] [Bug 35104] We should warn when attempting to save MARC records that contain characters invalid in XML

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Oct 31 04:50:34 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35104

--- Comment #14 from David Cook <dcook at prosentient.com.au> ---
I had an interesting experience that I thought I'd share here since it's
relevant.

One of my librarians was copying and pasting text from a PDF into Koha. When
they did it, it generated a broken MARC record. When I did it, it worked fine.

That's when I discovered that Chrome, Firefox, and Edge all treat PDF text
differently.

Consider the following phrase "like-minded people" which is actually broken
against 2 lines on the hyphen in the PDF. If you copy from Chrome, it removes
the hyphen so it becomes "likeminded people". If you copy from Firefox, it
copies the hyphen and a line break so it becomes something like "like-\nminded
people". If you copy from Edge, it mangles the hyphen and turns it into a
"Start of text" control character, which will break Koha.

--

While we work through our official solution, I came up with a little Javascript
function which is run during the "paste" event in the MARC editor. It displays
a "confirm" box which contains an explanatory warning, offers a tip on
understanding the problem, and then provides an option to try to "fix" the
record (by stripping out the bad characters).

I'm just running that in their "IntranetUserJS" for now, but I thought I'd
share this information. 

I think having a warning at "save time" is very useful especially for imported
records. This "on paste" warning might also be useful though since it's at the
time that they're entering the data, so it might be easier for them to notice
the problem.

--

In any case, it was great to find an example from the wild to test a fix
against...

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list