Control desire 2018-12-04 16:03 采纳率: 0%
浏览 707

Jsoup解析不到路径中含有中文的html文件吗?

String path = jsoupDemo.class.getResource("/index.html").getPath();
System.out.println(path);//打印获取到的路径打印是可以找打路径的
结果是 D:/ideawork/myproject/web_day42_jsoup%e7%88%ac%e8%99%ab/target/classes/index.html

File file = new File(path);
Document dom = Jsoup.parse(file, "utf-8");
System.out.println(dom);
为什么解析不到index.html中的内容

  • 写回答

1条回答 默认 最新

  • zhangpan_soft 2018-12-05 04:15
    关注

    这个路径是需要经过URLEncoder编码,和URLDecoder解码才可以,中文路径必须这样来,

    评论

报告相同问题?