Fix bug 466367 - Receiving acceptation from Windows version of Lightning to Linux version results a garbled e-mail with no reaction on calendar. r=bienvenu
authorDaniel Boelzle [:dbo] <daniel.boelzle@sun.com>
Fri, 28 Nov 2008 11:19:50 +0100
changeset 1250 a9abcbb479da2bbc4f44a55d4741e83af8667247
parent 1249 d88b39fbf6977ef806cd7e21ea170b033db359c0
child 1251 500a37c0bb0b2010ac23959ce1fe87466b6a83da
push idunknown
push userunknown
push dateunknown
reviewersbienvenu
bugs466367
Fix bug 466367 - Receiving acceptation from Windows version of Lightning to Linux version results a garbled e-mail with no reaction on calendar. r=bienvenu
calendar/itip/calItipEmailTransport.js
--- a/calendar/itip/calItipEmailTransport.js
+++ b/calendar/itip/calItipEmailTransport.js
@@ -301,19 +301,25 @@ calItipEmailTransport.prototype = {
     },
 
     _createTempImipFile: function cietCTIF(compatMode, aToList, aSubject, aBody, aItem, aIdentity) {
         try {
             function encodeUTF8(text) {
                 return convertFromUnicode("UTF-8", text).replace(/(\r\n)|\n/g, "\r\n");
             }
             function encodeMimeHeader(header) {
-                var mimeConverter = Components.classes["@mozilla.org/messenger/mimeconverter;1"]
+                let mimeConverter = Components.classes["@mozilla.org/messenger/mimeconverter;1"]
                                               .createInstance(Components.interfaces.nsIMimeConverter);
-                return mimeConverter.encodeMimePartIIStr(encodeUTF8(header), false, "UTF-8", header.indexOf(":") + 2, 72);
+                let fieldNameLen = (header.indexOf(": ") + 2);
+                return (header.substring(0, fieldNameLen) +
+                        mimeConverter.encodeMimePartIIStr_UTF8(header.substring(fieldNameLen),
+                                                               false,
+                                                               "UTF-8",
+                                                               fieldNameLen,
+                                                               72 - fieldNameLen));
             }
 
             var itemList = aItem.getItemList({});
             var serializer = Components.classes["@mozilla.org/calendar/ics-serializer;1"]
                                        .createInstance(Components.interfaces.calIIcsSerializer);
             serializer.addItems(itemList, itemList.length);
             var methodProp = getIcsService().createIcalProperty("METHOD");
             methodProp.value = aItem.responseMethod;