提交 eeeda9ee 编写于 作者: S Seiji Sogabe

[FIXED HUDSON-8270] escape quotes.

上级 feefea92
......@@ -807,6 +807,12 @@ public class Util {
if(ch=='&')
buf.append("&");
else
if(ch=='"')
buf.append(""");
else
if(ch=='\'')
buf.append("'");
else
if(ch==' ') {
// All spaces in a block of consecutive spaces are converted to
// non-breaking space ( ) except for the last one. This allows
......
......@@ -170,4 +170,11 @@ public class UtilTest extends TestCase {
Util.deleteRecursive(d);
}
}
public void TestEscape() {
assertEquals("<br>", Util.escape("\n"));
assertEquals("&lt;a>", Util.escape("<a>"));
assertEquals("&quot;&#039;", Util.escape("'\""));
assertEquals("&nbsp; ", Util.escape(" "));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册