https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44218 Bug ID: 44218 Summary: unimarc_field_4XX.pl copies HTML entities (& " ') into 4XX subfields Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: f.demians@tamil.fr QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Target Milestone: --- When cataloguing a UNIMARC record, the 4XX linking plugin (unimarc_field_4XX.pl) copies some subfields of the linked record (200$a, 200$e, 200$f, 210$c, etc.) into the 4XX field being edited (461, 463, 410...). If these values contain an ampersand or a double quote, they are copied as HTML entities (&, ") and saved as-is in the record. On some systems (for instance Ubuntu 22.04, whose Template Toolkit package also escapes apostrophes in the html filter), every apostrophe is copied as ' too, so most titles in French, Italian, English... are corrupted. Example: linking a record to a record titled L'Adattamento umano all'ambiente passato e presente fills 463$t with L'Adattamento umano all'ambiente passato e presente On one production catalogue, about 1,900 records were found with such entities in their 4XX fields. Cause: in unimarc_field_4XX.tt, values are injected into JavaScript with: subfield.value = "[% To.json( subfield_value_t ) | html %]"; To.json already escapes the value for a JavaScript string; the extra html filter should not be there ($raw is used everywhere else with To.json inside a script). To reproduce: 1. Use a UNIMARC installation. 2. Create a record A whose title (200$a) is: L'art "roman" & gothique 3. Create a new record B and link it to A in 463 using the 4XX plugin. 4. Look at 463$t in record B: it contains & and " (and ' on some systems) instead of the original characters. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.