Interactive Book displays ' instead of apostrophe (') in chapter titles

Hi all,

I’m having an issue with apostrophes in Interactive Book chapter titles.

When I enter a normal apostrophe in a title, for example "Australia's Family Law System", it appears on the chapter card with the HTML code:

Australia's Family Law System

I checked the exported H5P file, and content.json contains a normal apostrophe, not HTML. This has happened in multiple chapter titles. Replacing the normal apostrophe with a curly apostrophe (’) makes it display correctly.

I’m using Moodle 4.5.12, Interactive Book 1.15 and Chrome on desktop.

Interactive Book Chapter Title Displaying HTML

Content types: 
BV52's picture

Hi,

Just to confirm, you are using the built in H5P plugin in Moodle? If so can you please provide the following:

  1. Moodle version
  2. Plugin version
  3. Interactive Book version

-BV

otacke's picture

@BV: That's an issue with HTML encoding.

H5P.Components.CoverPage will not render HTML encoded titles in https://github.com/h5p/h5p-components/blob/e3c90215c46971aaf527b83b746cac196142404c/src/components/h5p-cover-page.js#L76. That's done to prevent scripting-attacks, which is good. InteractiveBook, passes the metadata title here, which contains HTML encodes symbols, however. That's what you see here. For instance an apostrophe will be displayed by it's HTML encoded representation `'`, an ampersand (&) would be `&`, etc. Compare https://www.w3schools.com/html/html_entities.asp for details.

Either, Interactive Book should ensure proper encoding (and remove scripts maybe), or H5P.Components.CoverPage should do that. The latter would be smarter propably.

Also note: The status bar at the top and the bottom of the navigation panel on the left side suffers from the same problem. Needs fixing in Interactive Book.

Proposed fixes:

 

BV52's picture

Hi Oliver,

Thank you for the explanation and the proposed fix. Sorry it took a while to approve your comment. We are having issues with the notifications from the froums.

-BV

Hi BV,

Yes, I'm using Moodle's built-in H5P plugin.

  • Moodle version: 4.5.12
  • H5P framework: v1.28 (sorry if this is not the right info, i couldnt see any version numbers other than this.)
  • Interactive Book: 1.15.0

 

Let me know if you need any other information.

- Diana