summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_html.class2
-rwxr-xr-xtests/it_html.t6
2 files changed, 7 insertions, 1 deletions
diff --git a/it_html.class b/it_html.class
index 46a4333..47444a6 100644
--- a/it_html.class
+++ b/it_html.class
@@ -410,7 +410,7 @@ function sanitize($html)
$result .= it_html::sanitize($head) . "<br />" . it_html::sanitize($tail);
}
else
- $result = it_html::Q(it::replace(array('&#\d+;' => ""), html_entity_decode(strip_tags($html), ENT_COMPAT, $charset)));
+ $result = it::replace(array('&amp;(#\d+;)' => '&$1'), it_html::Q(html_entity_decode(strip_tags($html), ENT_COMPAT, $charset)));
return $result;
}
diff --git a/tests/it_html.t b/tests/it_html.t
index 3b4dc2f..883753d 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -99,6 +99,12 @@ is(
'it_html::sanitize tag soup'
);
+is(
+ it_html::sanitize('q&#8592;x'),
+ "q&#8592;x",
+ 'it_html::sanitize preserve numeric entities'
+);
+
it_html::configure(array('charset' => "utf-8"));
is(
it_html::sanitize('q&uuml;x'),