public static String toHTML(String text, boolean isEscapeSpace)
{
if ((text == null) || ("".equals(text))) {
return "";
}
char[] content = new char[text.length()];
text.getChars(0, text.length(), content, 0);
StringBuilder result = new StringBuilder();
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
case '\n':
result.append("<br/>");
break;
case '\r':
break;
case '<':
result.append("<");
break;
case '>':
result.append(">");
break;
case '&':
result.append("&");
break;
case '\'':
result.append("'");
break;
case '"':
result.append(""");
brea
Xss防御-特殊字符处理
最新推荐文章于 2023-08-25 10:51:48 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)