html2text function called indirectly from format_text_email function is not compatible with utf-8 charset encoding. html2text replaces all chr(160) bytes with ' ' at end of the function, while chr(160) in utf-8 encoding does not mean a white space. This causes some characters in utf-8 encoding such as 'da' (U+3060) characters in ja_utf8 garbled in text formatted email.
— ../20050325/moodle/lib/html2text.php Sun Jan 23 11:18:50 2005
+++ html2text.php Sat Mar 26 16:56:06 2005
@@ -157,12 +157,12 @@
$goodStr = wordwrap( $goodStr, 78 );
//make sure there are no more than 3 linebreaks in a row and trim whitespace
- $goodStr = str_replace(chr(160), ' ', $goodStr );
+// $goodStr = str_replace(chr(160), ' ', $goodStr );
$goodStr = preg_replace(/\r\n?/\f/, \n, $goodStr);
$goodStr = preg_replace(/\n(\s*\n)
{2}/, \n\n\n, $goodStr);
$goodStr = preg_replace(/[ \t]+(\n/$)/, $1, $goodStr);
$goodStr = preg_replace(/^\n*/\n*$/, '', $goodStr);
- $goodStr = str_replace(chr(160), ' ', $goodStr );
+// $goodStr = str_replace(chr(160), ' ', $goodStr );
return $goodStr;