I am using a local validator.nu instance to validate a site, however it keeps telling me the encoding does not match:
Internal encoding declaration “iso-8859-1” disagrees with the actual encoding of the document (“utf-8”).
I've done everything to try and get the encoding to be forced to iso-8859-1 as we are using a legacy DB that requires this encoding.
- Process that starts forces
LANG='iso-8859-1'
- Forcing
file.encoding
on tomcat startup-Dfile.encoding=iso-8859-1
, this is confirmed by checkingCharset.defaultCharset()
which reportsISO-8859-1
. - Maven project resources are copied with
iso-8859-1
:<project.build.sourceEncoding>iso-8859-1</project.build.sourceEncoding>
- JSP
page
directive specifies encoding:<%@page contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
Content-Type
has been set in page head:<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
- Tomcat
URIEncoding
set:<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="iso-8859-1" redirectPort="8443" />
What else could I have missed that's causing the page to come back as utf-8
?
Interestingly it is rendering characters like © correctly, and if © is placed in a text input it is saved to the DB correctly using the 8859-1 codepage.
UPDATE: I've just decided to download a page from the server with cURL and upload to the w3 checker which validated successfully. The only issue it had was the naming of iso-8859-1
should be windows-1252
though I thought those two character sets were slightly different, this w3 mailing-list entry says otherwise though, I need to look into that.
This is looking more and more like a bug in validator.nu which I will also look into.