FCKEditor always does UTF8, so force the Rmail encoding into that

Also calculate the email TEXT from the email HTML, its not perfect but pretty darn good.

TODO: need to do an update script that converts the encoding of ALL existing emails in the databse from ISO-8859-1 to UTF-8
DO NOT UPDATE TO THIS VERSION UNTIL I CAN ADD THAT CONVERSION SCRIPT
This commit is contained in:
james
2009-12-02 23:11:25 +00:00
parent 148bc61320
commit c0f6031904
2 changed files with 17 additions and 10 deletions

View File

@@ -956,6 +956,8 @@ function email_send_new($to,$from,$subject,$body,$bodyhtml="") {
$mail->setFrom($from);
$mail->setSubject($subject);
$mail->setText($body);
$mail->setTextCharset("utf-8");
$mail->setHTMLCharset("utf-8");
//only add the html if we have it
if($bodyhtml) {
@@ -1265,5 +1267,17 @@ function format_duration($seconds, $granularity = 2)
return $output ? $output : '0 sec';
}
function getTextFromHtml($html) {
//first, replace an </p> with </p><br />
$text=str_replace("</p>","</p><br />",$html);
//now replace any <br /> with newlines
$text=eregi_replace('<br[[:space:]]*/?[[:space:]]*>',chr(13).chr(10),$text);
//and strip the rest of the tags
$text=strip_tags($text);
//and replace &nbsp;
$text=str_replace("&nbsp;"," ",$text);
return $text;
}
?>