I have a resource (a static html page), that I wanna use to test. But, when I get the static page, it comes with some characters encoding. I try with the class StringEscapeUtils but it doesn't work. My function:
private HtmlPage getStaticPage() throws IOException, ClassNotFoundException {
final Reader reader = new InputStreamReader(this.getClass().getResourceAsStream("/" + "testPage" + ".html"), "UTF-8");
final StringWebResponse response = new StringWebResponse(StringEscapeUtils.unescapeHtml4(IOUtils.toString(reader)), StandardCharsets.UTF_8, new URL(URL_PAGE));
return HTMLParser.parseHtml(response, WebClientFactory.getInstance().getCurrentWindow());
}
import org.apache.commons.lang3.StringEscapeUtils;