把汉字转换为html实体编码

背景:工作中需要把汉字转换为html实体编码
实现方式:
import org.apache.commons.lang.StringEscapeUtils;
public static void main(String[] args)
{
 System.out.println(StringEscapeUtils.escapeHtml("您好"));//输出您好
        System.out.println(StringEscapeUtils.unescapeHtml("您好"));//输出您好
}

原文地址:https://www.cnblogs.com/MythLeige/p/5943234.html