function test_s() {
$this->assertEqual(s("This Breaks \" Strict"), "This Breaks " Strict");
}
+
+ function test_format_text_email() {
+ $this->assertEqual('This is a test',
+ format_text_email('<p>This is a <strong>test</strong></p>',FORMAT_HTML));
+ $this->assertEqual('This is a test',
+ format_text_email('<p class="frogs">This is a <strong class=\'fishes\'>test</strong></p>',FORMAT_HTML));
+ $this->assertEqual('& so is this',
+ format_text_email('<p>& so is this</p>',FORMAT_HTML));
+ $tl = textlib_get_instance();
+ $this->assertEqual('Two bullets: '.$tl->code2utf8(8226).' '.$tl->code2utf8(8226),
+ format_text_email('<p>Two bullets: • •</p>',FORMAT_HTML));
+ $this->assertEqual($tl->code2utf8(0x7fd2).$tl->code2utf8(0x7fd2),
+ format_text_email('<p>習習</p>',FORMAT_HTML));
+ }
}
?>
require_once($CFG->libdir .'/html2text.php');
- return html2text($html);
+ $result = html2text($html);
+
+ // html2text does not fix numerical entities so handle those here.
+ $tl=textlib_get_instance();
+ $result = $tl->entities_to_utf8($result,false);
+
+ return $result;
}
/**