|
@@ -17,6 +17,11 @@ import java.util.stream.Stream;
|
|
|
|
|
|
import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.lang3.text.translate.AggregateTranslator;
|
|
|
+import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
|
|
|
+import org.apache.commons.lang3.text.translate.EntityArrays;
|
|
|
+import org.apache.commons.lang3.text.translate.LookupTranslator;
|
|
|
+import org.apache.commons.lang3.text.translate.NumericEntityUnescaper;
|
|
|
import org.dom4j.Attribute;
|
|
|
import org.dom4j.Document;
|
|
|
import org.dom4j.DocumentException;
|
|
@@ -400,7 +405,8 @@ public final class CommonUtils {
|
|
|
return "";
|
|
|
}
|
|
|
htmlStr = repairHtmlStr(htmlStr);
|
|
|
- htmlStr = StringEscapeUtils.unescapeHtml4(htmlStr);
|
|
|
+ //htmlStr = StringEscapeUtils.unescapeHtml4(htmlStr);
|
|
|
+ htmlStr = UNESCAPE_HTML4.translate(htmlStr);
|
|
|
return htmlStr;
|
|
|
}
|
|
|
|
|
@@ -458,4 +464,15 @@ public final class CommonUtils {
|
|
|
System.out.println(formatDoubleFloor(3.61));
|
|
|
System.out.println(formatDoubleFloor(3.0));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * weiwenhai
|
|
|
+ * 过滤题干中<>,不让反转
|
|
|
+ */
|
|
|
+ public static final CharSequenceTranslator UNESCAPE_HTML4 =
|
|
|
+ new AggregateTranslator(
|
|
|
+ new LookupTranslator(EntityArrays.ISO8859_1_UNESCAPE()),
|
|
|
+ new LookupTranslator(EntityArrays.HTML40_EXTENDED_ESCAPE()),
|
|
|
+ new NumericEntityUnescaper()
|
|
|
+ );
|
|
|
}
|