報錯: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> </p>
String s2=HtmlUtils.htmlUnescape(s);
輸出
hello world
如果希望文本出現html標簽的內容,如<>,這些符號,就是使用htmlUnescape(s)