加载中...

报错:com.alibaba.fastjson.JSONException: illegal identifier : &pos 1, line 1, column

报错:com.alibaba.fastjson.JSONException: illegal identifier : &pos 1, line 1, column

原因:将HtmlUtils.htmlUnescape()错些成HtmlUtils.htmlEscape()

两种方法的不同:
String s=HtmlUtils.htmlEscape("

hello world

 

");

输出<div>hello world</div><p>&nbsp;</p>

String s2=HtmlUtils.htmlUnescape(s);

输出

hello world

 

如果希望文本出现html标签的内容,如<>,这些符号,就是使用htmlUnescape(s)

posted @ 2022-02-16 00:15  甜甜筒  阅读(2812)  评论(0)    收藏  举报