gunnar: server/php-kolab/Kolab_Filter/Filter Resource.php,1.7,1.8

cvs at kolab.org cvs at kolab.org
Thu Feb 28 12:11:48 CET 2008


Author: gunnar

Update of /kolabrepository/server/php-kolab/Kolab_Filter/Filter
In directory doto:/tmp/cvs-serv5931/php-kolab/Kolab_Filter/Filter

Modified Files:
	Resource.php 
Log Message:
kolab/issue2495

Index: Resource.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Filter/Filter/Resource.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Resource.php	26 Feb 2008 21:37:45 -0000	1.7
+++ Resource.php	28 Feb 2008 11:11:46 -0000	1.8
@@ -41,12 +41,12 @@
 require_once 'Horde/MIME/Structure.php';
 
 require_once 'Horde/String.php';
-String::setDefaultCharset('UTF-8');
+String::setDefaultCharset('utf-8');
 
 // Required to be able to use the old Horde framework
 function wrap($text) 
 {
-    return String::wrap($text, 76, "\n");
+    return String::wrap($text, 76, "\n", 'utf-8');
 }
 
 // What actions we can take when receiving an event request
@@ -1477,6 +1477,11 @@
                               __FILE__, __LINE__, PEAR_LOG_ERR);
             $deleted_messages = array();
         }
+
+        /* Ensure that $summary is single byte here, else we get
+         * problems with sprintf()
+         */
+        $summary = String::convertCharset($summary, 'utf-8', 'iso-8859-1');
         if (empty($deleted_messages)) {
             Horde::logMessage(sprintf(_("Canceled event %s is not present in %s's calendar"),
                                       $sid, $resource),
@@ -1487,6 +1492,10 @@
             $body = sprintf(_("The following event has been successfully removed:\r\n\r\n%s"), $summary);
             $subject = sprintf(_("%s has been cancelled"), $summary);
         }
+        
+        /* Switch back to utf-8 */
+        $body = String::convertCharset($body, 'iso-8859-1');
+        $subject = String::convertCharset($subject, 'iso-8859-1');
 
         if (!is_array($deleted_messages)) {
             $deleted_messages = array($deleted_messages);
@@ -1496,7 +1505,7 @@
                                   $organiser),
                           __FILE__, __LINE__, PEAR_LOG_WARNING);
 
-        $body = &new MIME_Part('text/plain', wrap($body));
+        $body = &new MIME_Part('text/plain', wrap($body), 'utf-8');
         $mime = &MIME_Message::convertMimePart($body);
         $mime->setTransferEncoding('quoted-printable');
         $mime->transferEncodeContents();
@@ -1521,9 +1530,9 @@
 
         $msg = $mime->toString();
         if (is_object($msg_headers)) {
-            $headerArray = $mime->encode($msg_headers->toArray(), $mime->getCharset());
+            $headerArray = $mime->encode($msg_headers->toArray(), 'UTF-8');
         } else {
-            $headerArray = $mime->encode($msg_headers, $mime->getCharset());
+            $headerArray = $mime->encode($msg_headers, 'UTF-8');
         }
 
         /* Make sure the message has a trailing newline. */





More information about the commits mailing list