fix forbidden-apis failures
@@ -136,7 +136,7 @@ public class StandardHtmlEncodingDetectorTest {
@Test
public void tooLong() throws IOException {
// Create a string with 1Mb of '\0' followed by a meta
- String padded = new String(new byte[1000000]) + "<meta charset='windows-1252'>";
+ String padded = new String(new byte[1000000], StandardCharsets.ISO_8859_1) + "<meta charset='windows-1252'>";
// Only the first bytes should be prescanned, so the algorithm should stop before the meta tag
assertCharset(padded, null);
}
@@ -172,7 +172,7 @@ public class StandardHtmlEncodingDetectorTest {
public void replacement() throws IOException {
// Several dangerous charsets should are aliases of 'replacement' in the spec
String inString = "<meta charset='iso-2022-cn'>";
- assertCharset(new ByteArrayInputStream(inString.getBytes()), new ReplacementCharset());
+ assertCharset(new ByteArrayInputStream(inString.getBytes(StandardCharsets.ISO_8859_1)), new ReplacementCharset());
}
@Test
