Skip to content

Commit

Permalink
Make EncodingTester usable in testing parsed state
Browse files Browse the repository at this point in the history
This change updates EncodingTester to make it test the result for cases
when the expected character encoding is not limited to what can be
determined by checking only the first 1024 bytes of the input stream.

Otherwise, without this change, EncodingTester is limited to only being
useful for testing the output of the meta prescan.
  • Loading branch information
sideshowbarker committed Aug 30, 2020
1 parent cd53ca7 commit 80dc4db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test-src/nu/validator/htmlparser/test/EncodingTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

public class EncodingTester {

protected static int SNIFFING_LIMIT = 16384;

private final InputStream aggregateStream;

private final StringBuilder builder = new StringBuilder();
Expand All @@ -59,7 +61,7 @@ private boolean runTest() throws IOException, SAXException {
}
UntilHashInputStream stream = new UntilHashInputStream(aggregateStream);
HtmlInputStreamReader reader = new HtmlInputStreamReader(stream, null,
null, null, Heuristics.NONE);
null, null, Heuristics.NONE, SNIFFING_LIMIT);
Charset charset = reader.getCharset();
stream.close();
if (skipLabel()) {
Expand Down

0 comments on commit 80dc4db

Please sign in to comment.