]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Avoid potentially double encoding already utf-8 encoded messages
authorCraig Andrews <candrews@integralblue.com>
Wed, 29 Jul 2009 02:47:32 +0000 (22:47 -0400)
committerCraig Andrews <candrews@integralblue.com>
Wed, 29 Jul 2009 02:47:32 +0000 (22:47 -0400)
scripts/maildaemon.php

index 9b3628b8631d8b3586349a31281b63fdddb5ad38..3ef4d06383f99cba74214c5f170d5ececcbd20a9 100755 (executable)
@@ -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