steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr olhacks.php, 1.4, 1.5

cvs at intevation.de cvs at intevation.de
Wed Apr 27 16:25:10 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr
In directory doto:/tmp/cvs-serv32169/kolab-resource-handlers/resmgr

Modified Files:
	olhacks.php 
Log Message:
even more Outlook hacks :-/ (Issue665)

Index: olhacks.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/olhacks.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- olhacks.php	12 Apr 2005 09:58:49 -0000	1.4
+++ olhacks.php	27 Apr 2005 14:25:08 -0000	1.5
@@ -68,6 +68,32 @@
   }
 }
 
+/* Yet another Outlook problem: Outlook seems to be incapable
+ * of handling non-ascii characters in forwarded iCal messages.
+ * As a solution, we encode common characters as humanreadable
+ * two-letter ascii.
+ */
+/* static */ function olhacks_recode_to_ascii( $text ) {
+  myLog("recoding \"$text\"", RM_LOG_DEBUG);
+  $text = str_replace( ('æ'), 'ae', $text );
+  $text = str_replace( ('ø'), 'oe', $text );
+  $text = str_replace( ('Ã¥'), 'aa', $text );
+  $text = str_replace( ('ä'), 'ae', $text );
+  $text = str_replace( ('ö'), 'oe', $text );
+  $text = str_replace( ('ü'), 'ue', $text );
+  $text = str_replace( ('ß'), 'ss', $text );
+
+  $text = str_replace( ('Æ'), 'Ae', $text );
+  $text = str_replace( ('Ø'), 'Oe', $text );
+  $text = str_replace( ('Ã…'), 'Aa', $text );
+  $text = str_replace( ('Ä'), 'Ae', $text );
+  $text = str_replace( ('Ö'), 'Oe', $text );
+  $text = str_replace( ('Ü'), 'Ue', $text );
+  myLog("recoded to \"$text\"", RM_LOG_DEBUG);
+
+  return $text;
+}
+
 /* main entry point */
 function olhacks_embedical( $fqhostname, $sender, $recipients, $origfrom, $subject, $tmpfname ) {
   myLog("Encapsulating iCal message forwarded by $sender", RM_LOG_DEBUG);
@@ -98,8 +124,9 @@
   $toppart = &new MIME_Message();
   $dorigfrom = Mail_mimeDecode::_decodeHeader($origfrom);
   $textpart = &new MIME_Part('text/plain', sprintf($forwardtext,$dorigfrom,$dorigfrom), 'UTF-8' );
-  $msgpart = &new MIME_Part($basepart->getType(), $basepart->transferDecode(), 
+  $msgpart = &new MIME_Part($basepart->getType(), olhacks_recode_to_ascii($basepart->transferDecode()), 
 			    $basepart->getCharset() );
+  
   $toppart->addPart($textpart);
   $toppart->addPart($msgpart);
   





More information about the commits mailing list