projectEndings / staticSearch

A codebase to support a pure JSON search engine requiring no backend for any XHTML5 document collection
https://endings.uvic.ca/staticSearch/docs/index.html
Mozilla Public License 2.0
46 stars 21 forks source link

We should avoid having two declarations of UTF-8 in the search page #279

Closed martindholmes closed 8 months ago

martindholmes commented 8 months ago

Right now, our output element for processing the search page looks like this:

<xsl:output method="xhtml" encoding="UTF-8" normalization-form="NFC"
        exclude-result-prefixes="#all" omit-xml-declaration="yes" html-version="5.0"/>

That means that a content-type element WILL be generated in the output page, meaning that if there is already a meta tag specifying the same thing, the page will generate a warning in the vnu validator. We could add this:

include-content-type="no"

but then if there is NO meta tag in the incoming file, there will be no charset info, so the browser will default to 8859-1. So instead, I think we should match and delete the meta tag, so that there is always a single declaration; or we should not include a content type, but make sure we add the meta tag. I like the latter option.

This fix should be backported to 1.4.x.

martindholmes commented 8 months ago

It turns out it's more practical to include the content-type version through xsl:output and suppress meta[@charset], so that's what I've done. Fix committed to both release-1.4 and dev branches.