Index: lib/html2text.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/html2text.php,v
retrieving revision 1.8.26.6
diff -u -r1.8.26.6 html2text.php
--- lib/html2text.php	22 May 2009 02:21:34 -0000	1.8.26.6
+++ lib/html2text.php	15 Jun 2009 05:32:39 -0000
@@ -30,6 +30,7 @@
  *                                                                       *
  *************************************************************************/
 
+require_once "$CFG->libdir/textlib.class.php";
 
 /**
  *  Takes HTML and converts it to formatted, plain text.
@@ -471,7 +472,8 @@
         $text = preg_replace_callback($this->callback_search, array(&$this, '_preg_callback'), $text);
 
         // Replace known html entities
-        $text = utf8_encode(html_entity_decode($text));
+        $tl=textlib_get_instance();
+        $text = $tl->entities_to_utf8($text, true);
 
         // Remove unknown/unhandled entities (this cannot be done in search-and-replace block)
         $text = preg_replace('/&[^&;]+;/i', '', $text); 
Index: lib/html2text_readme.txt
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/html2text_readme.txt,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 html2text_readme.txt
--- lib/html2text_readme.txt	22 May 2009 02:21:35 -0000	1.1.2.3
+++ lib/html2text_readme.txt	15 Jun 2009 05:32:39 -0000
@@ -12,13 +12,12 @@
 
 by using this code:
 
-  utf8_encode(html_entity_decode($string));
+  $tl=textlib_get_instance();
+  $text = $tl->entities_to_utf8($text, true);
 
 instead of:
 
-  html_entity_decode($string, ENT_COMPAT, 'UTF-8');
-
-(see http://nz.php.net/manual/en/function.html-entity-decode.php#89483)
+  $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
 
 
 2- fixed error in preg_replace_callback on php4
