![](/img/trans.png)
[英]how to unescape html entities **except** < > & " ' in java
[英]How to unescape HTML 5 entities in Java (')
这个问题的答案大多建议使用 apache-common-text StringEscapeUtils
。 但是这个(commons-text 的最新版本是 1.9)只支持 HTML 4,而Mastodon 似乎使用 HTML 5 ,其中包括'
. 如何解码 HTML 5 实体,包括'
?
unbescape做得很好:
final String unescapedText = HtmlEscape.unescapeHtml("'");
System.out.println(unescapedText);
结果:
'
马文:
<!-- https://mvnrepository.com/artifact/org.unbescape/unbescape -->
<dependency>
<groupId>org.unbescape</groupId>
<artifactId>unbescape</artifactId>
<version>1.1.6.RELEASE</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.