From b60e4cc9a3f99a8cf932210d18243441a3bb85c8 Mon Sep 17 00:00:00 2001 From: fmarier Date: Fri, 22 May 2009 02:19:00 +0000 Subject: [PATCH] MDL-19266 lib/html2text: fix warnings in cron when using PHP4 --- lib/html2text.php | 2 +- lib/html2text_readme.txt | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/html2text.php b/lib/html2text.php index dbf0943d54f..f626f8d9164 100644 --- a/lib/html2text.php +++ b/lib/html2text.php @@ -471,7 +471,7 @@ class html2text $text = preg_replace_callback($this->callback_search, array('html2text', '_preg_callback'), $text); // Replace known html entities - $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8'); + $text = utf8_encode(html_entity_decode($text)); // Remove unknown/unhandled entities (this cannot be done in search-and-replace block) $text = preg_replace('/&[^&;]+;/i', '', $text); diff --git a/lib/html2text_readme.txt b/lib/html2text_readme.txt index 8ed6ca73f33..a4079e68553 100644 --- a/lib/html2text_readme.txt +++ b/lib/html2text_readme.txt @@ -1,5 +1,24 @@ -html2text.php is an unmodified copy of a file shipped with the RoundCube project: +html2text.php is a modified copy of a file shipped with the RoundCube project: http://trac.roundcube.net/log/trunk/roundcubemail/program/lib/html2text.php + +Modifications +-------------- + +1- fix for these warnings in cron: + + "html_entity_decode bug - cannot yet handle MBCS in html_entity_decode()!" + +by using this code: + + utf8_encode(html_entity_decode($string)); + +instead of: + + html_entity_decode($string, ENT_COMPAT, 'UTF-8'); + +(see http://nz.php.net/manual/en/function.html-entity-decode.php#89483) + + -- Francois Marier 2009-05-22