summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-07-28 22:47:32 -0400
committerCraig Andrews <candrews@integralblue.com>2009-07-28 22:47:32 -0400
commitf3352254b792b201b1acaa93c9f58530c671ad11 (patch)
treea73cbe58e9a892e31b5a2fe4e7468e7458f859ab
parent5aa303320b4e57f5296eccba5bba7134cc12503f (diff)
Avoid potentially double encoding already utf-8 encoded messages
-rwxr-xr-xscripts/maildaemon.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 9b3628b86..3ef4d0638 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -301,7 +301,7 @@ class MailerDaemon
$this->extract_part($parsed,$msg,$attachments);
- return array($from, $to, utf8_encode($msg), $attachments);
+ return array($from, $to, $msg, $attachments);
}
function extract_part($parsed,&$msg,&$attachments){
@@ -317,6 +317,9 @@ class MailerDaemon
} else if ($parsed->ctype_primary == 'text'
&& $parsed->ctype_secondary=='plain') {
$msg = $parsed->body;
+ if(strtolower($parsed->ctype_parameters['charset']) != "utf-8"){
+ $msg = utf8_encode($msg);
+ }
}else if(!empty($parsed->body)){
if(common_config('attachments', 'uploads')){
//only save attachments if uploads are enabled