Skip to content

Commit 80dc4db

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 cd53ca7 commit 80dc4db

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
@@ -36,6 +36,8 @@
3636

3737
public class EncodingTester {
3838

39+
protected static int SNIFFING_LIMIT = 16384;
40+
3941
private final InputStream aggregateStream;
4042

4143
private final StringBuilder builder = new StringBuilder();
@@ -59,7 +61,7 @@ private boolean runTest() throws IOException, SAXException {
5961
}
6062
UntilHashInputStream stream = new UntilHashInputStream(aggregateStream);
6163
HtmlInputStreamReader reader = new HtmlInputStreamReader(stream, null,
62-
null, null, Heuristics.NONE);
64+
null, null, Heuristics.NONE, SNIFFING_LIMIT);
6365
Charset charset = reader.getCharset();
6466
stream.close();
6567
if (skipLabel()) {

0 commit comments

Comments
 (0)