From 4e42a90c538551a279d5126ad856a6c7dfdd5e44 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 23 Mar 2009 03:41:34 +0000 Subject: [PATCH] weblib: Fix test_format_text_email and unit tests. --- lib/simpletest/testweblib.php | 4 ++-- lib/weblib.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/simpletest/testweblib.php b/lib/simpletest/testweblib.php index 06e3b51ffb..961cd3e6a9 100644 --- a/lib/simpletest/testweblib.php +++ b/lib/simpletest/testweblib.php @@ -42,9 +42,9 @@ class web_test extends UnitTestCase { } function test_format_text_email() { - $this->assertEqual('This is a test', + $this->assertEqual('This is a TEST', format_text_email('

This is a test

',FORMAT_HTML)); - $this->assertEqual('This is a test', + $this->assertEqual('This is a TEST', format_text_email('

This is a test

',FORMAT_HTML)); $this->assertEqual('& so is this', format_text_email('

& so is this

',FORMAT_HTML)); diff --git a/lib/weblib.php b/lib/weblib.php index dbfdc9003f..adff83fef1 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2074,7 +2074,7 @@ function html_to_text($html) { $result = $h2t->get_text(); // html2text does not fix HTML entities so handle those here. - $result = html_entity_decode($result, ENT_NOQUOTES, 'UTF-8'); + $result = trim(html_entity_decode($result, ENT_NOQUOTES, 'UTF-8')); return $result; } -- 2.39.5