diff --git a/test/unit/chunks/nowiki_test.rb b/test/unit/chunks/nowiki_test.rb
index 8bd3837e..8307e089 100755
--- a/test/unit/chunks/nowiki_test.rb
+++ b/test/unit/chunks/nowiki_test.rb
@@ -42,4 +42,10 @@ class NoWikiTest < Test::Unit::TestCase
)
end
+ def test_sanitize_nowiki_bad_utf8
+ match(NoWiki, "
\357elephant & \302ivory
" + output = "\357\277\275elephant & \357\277\275ivory
" + check_sanitization(input, output, output, output) + end Sanitizer::ALLOWED_ELEMENTS.each do |tag_name| define_method "test_should_allow_#{tag_name}_tag" do diff --git a/test/unit/sanitizer_test.rb b/test/unit/sanitizer_test.rb index 3e94bf01..b78398c2 100644 --- a/test/unit/sanitizer_test.rb +++ b/test/unit/sanitizer_test.rb @@ -30,6 +30,12 @@ class SanitizerTest < Test::Unit::TestCase assert_equal(output2, input.to_utf8) end + def test_sanitize_malformed_utf8 + input = "\357elephant & \302ivory
".purify + output = "ephant & vory
" + check_sanitization(input, output, output, output) + end + Sanitizer::ALLOWED_ELEMENTS.each do |tag_name| define_method "test_should_allow_#{tag_name}_tag" do input = "<#{tag_name} title='1'>foo