unbescape 是一个Java的转义库,特点是高性能和易用,而且功能强大,支持多种格式的转义,包括:
HTML (HTML5andHTML4)
XML (XML1.0andXML1.1)
JavaScript
JSON
URI / URL (bothpathsandqueryparameters)
CSS (bothidentifiersandstringliterals)
CSV (Comma-SeparatedValues)
Javaliterals
Java .properties files (bothkeysandvalues)
示例代码:
final String escaped = HtmlEscape.escapeHtml( text, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_HEXA, HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
评论