Skip to content

Commit 02e7dc7

Browse files
Make EncodingTester usable in testing parsed state
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.
1 parent c957a8d commit 02e7dc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test-src/nu/validator/htmlparser/test/EncodingTester.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public class EncodingTester {
3838

3939
private static int exitStatus = 0;
4040

41+
protected static int SNIFFING_LIMIT = 16384;
42+
4143
private final InputStream aggregateStream;
4244

4345
private final StringBuilder builder = new StringBuilder();
@@ -61,7 +63,7 @@ private boolean runTest() throws IOException, SAXException {
6163
}
6264
UntilHashInputStream stream = new UntilHashInputStream(aggregateStream);
6365
HtmlInputStreamReader reader = new HtmlInputStreamReader(stream, null,
64-
null, null, Heuristics.NONE);
66+
null, null, Heuristics.NONE, SNIFFING_LIMIT);
6567
Charset charset = reader.getCharset();
6668
stream.close();
6769
if (skipLabel()) {

0 commit comments

Comments
 (0)