java如何还原被转义的HTML特殊字符
我们可以使用
hutool工具类来进行还原
首先引入pom依赖
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.5.8</version>
</dependency>
HtmlUtil.unescape还原被转义的HTML特殊字符
String escape = "<html><body>123'123'</body></html>";
// 结果为:<html><body>123'123'</body></html>
String unescape = HtmlUtil.unescape(escape);
本文介绍如何使用Hutool工具类中的HtmlUtil.unescape方法来还原被转义的HTML特殊字符。通过引入Hutool依赖并调用此方法,可以轻松地将转义后的HTML文本转换回原始形式。
1193

被折叠的 条评论
为什么被折叠?



