阅读JSP页面和编写HTML文件UTF-8问题

时间:2015-04-02 10:44:44

标签: java jsp utf-8 jsoup

我想阅读JSP页面并将其写入HTML页面。我在解析类中有3个方法。第一个readHTMLBody(),第二个WriteNewHTML(),第三个ZipToEpub()。 当我在parse类中调用此方法时,所有方法都有效。但是在JSP或webservice中调用UTF-8字符看起来像“?”在readHTMLBody()。我该如何解决?

  public String readHTMLBody() {
    try {
        String url = "http://localhost:8080/Library/part.jsp";
        Document doc = Jsoup.parse((new URL(url)).openStream(), "utf-8", url);
        String body = doc.html();
        Elements title = doc.select("xxx");
        linkURI = title.toString();
        linkURI = linkURI.replaceAll("<xxx>", "");
        linkURI = linkURI.replaceAll("</xxx>", "");
        linkURI = linkURI.replaceAll("\\s", "");
        resultBody = body;
        resultBody = resultBody.replaceAll("part/" + linkURI + "/assets/", "assets/");
    } catch (IOException e) {
    }

    return resultBody;
}

0 个答案:

没有答案