浏览代码

Merge pull request #1121 from totalo/v5-dev

fixed #1118
Golden Looly 5 年之前
父节点
当前提交
4899e03a48

+ 1 - 0
hutool-core/src/main/java/cn/hutool/core/text/escape/Html4Escape.java

@@ -18,6 +18,7 @@ public class Html4Escape extends ReplacerChain {
 			{ "&", "&" }, // & - ampersand
 			{ "<", "&lt;" }, // < - less-than
 			{ ">", "&gt;" }, // > - greater-than
+			{"\'", "&apos;"} // ' - quote
 	};
 
 	protected static final String[][] ISO8859_1_ESCAPE = { //

+ 1 - 0
hutool-http/src/test/java/cn/hutool/http/test/HtmlUtilTest.java

@@ -119,6 +119,7 @@ public class HtmlUtilTest {
 		Assert.assertEquals("&lt;html&gt;&lt;body&gt;123&#039;123&#039;&lt;/body&gt;&lt;/html&gt;", escape);
 		String restoreEscaped = HtmlUtil.unescape(escape);
 		Assert.assertEquals(html, restoreEscaped);
+		Assert.assertEquals("\'", HtmlUtil.unescape("&apos;"));
 	}
 	
 	@Test