[英]How to unescape HTML 5 entities in Java (')
The answers to this question mostly suggest to use apache-common-text StringEscapeUtils
. 这个问题的答案大多建议使用 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 which includes '
但是这个(commons-text 的最新版本是 1.9)只支持 HTML 4,而Mastodon 似乎使用 HTML 5 ,其中包括
'
. . How can I decode HTML 5 entities, including
'
如何解码 HTML 5 实体,包括
'
? ?
unbescape does the job well: unbescape做得很好:
final String unescapedText = HtmlEscape.unescapeHtml("'");
System.out.println(unescapedText);
Result:结果:
'
Maven:马文:
<!-- 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.