如何在 Java (') 中对 HTML 5 个实体进行转义

How to unescape HTML 5 entities in Java (')

this question mostly suggest to use apache-common-text StringEscapeUtils. But this (latest version of commons-text is 1.9) only supports HTML 4, and Mastodon appears to use 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>