Comment #4 on issue 30 by
mikes...@gmail.com: " " returns space
I don't know what CKEditor has to do with this bug, and you talk about '?'
in the output but to understand the output, I'd have to actually see the
headers and meta-content of the response you're serving.
I added a test (see patch below) and entities seems to work fine. The HTML
sanitizer decodes entities just fine and normalizes them in the output.
As long as your content-type header's charset matches the charset you used
to encode your string, then the content should reach the browser just fine.
Index: src/tests/org/owasp/html/HtmlPolicyBuilderTest.java
===================================================================
--- src/tests/org/owasp/html/HtmlPolicyBuilderTest.java (revision 235)
+++ src/tests/org/owasp/html/HtmlPolicyBuilderTest.java (working copy)
@@ -282,6 +282,17 @@
"<select>\n <option>1</option>\n
<option>2</option>\n</select>"));
}
+ @Test
+ public static final void testEntities() throws Exception {
+ assertEquals(
+ "(Foo)\u00a0(Bar)\u2666\u2666\u2666\u2666(Baz)"
+ + "𔠴𔠴𔠴(Boo)",
+ apply(
+ new HtmlPolicyBuilder(),
+ "(Foo) (Bar)♦♦♦♦(Baz)"
+ + "\ud812\udc34𔠴𔠴(Boo)"));
+ }
+
private static String apply(HtmlPolicyBuilder b) throws Exception {
return apply(b, EXAMPLE);