Skip to content

Commit 81c40ef

Browse files
Conform MetaSniffer "x-user-defined" handling
This change makes the parser’s meta-prescan code conform to the requirements in the spec for handling of the "x-user-defined" encoding.
1 parent 0023390 commit 81c40ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/nu/validator/htmlparser/io/MetaSniffer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ protected boolean tryCharset(String encoding) throws SAXException {
165165
this.characterEncoding = Encoding.UTF8;
166166
err(Encoding.msgIgnoredCharset(encoding, "utf-8"));
167167
return true;
168+
} else if ("x-user-defined".equals(encoding)) {
169+
this.characterEncoding = Encoding.WINDOWS1252;
170+
err(Encoding.msgIgnoredCharset("x-user-defined", "windows-1252"));
171+
return true;
168172
} else {
169173
Encoding cs = Encoding.forName(encoding);
170174
String canonName = cs.getCanonName();

0 commit comments

Comments
 (0)