package com.nuvole.util; import org.apache.commons.lang.CharEncoding; import org.junit.Test; /** * @author ChenLong * @version 1.0 * @ClassName XssUtilTest * @date 2019/7/16 18:42 */ public class XssUtilTest { @Test public void clearXss() throws Exception { String val = "

qqqqxxxxfffffffffff

\n" + "

\"lalalal\"

"; System.out.println(XssUtil.clearXss(val)); } @Test public void test() throws Exception { String b = "aaaa"; byte[] a = b.getBytes(CharEncoding.ISO_8859_1); System.out.println("is a:" + a); String s2 = XssUtil.clearXss(new String(a, CharEncoding.ISO_8859_1)); System.out.println("s2:" + s2); System.out.println("s2 byte:" + s2.getBytes(CharEncoding.ISO_8859_1)); } }