Bug 482131 - UTF-8 encoded invitation subject not displayed correctly; r=standard8
authorDaniel Boelzle [:dbo] <mozilla@boelzle.org>
Wed, 02 Sep 2009 17:14:19 +0200
changeset 3490 856938cc9dbee82f8dfaf817f528289c805c2616
parent 3489 75644ade5a9a533d44e7dca16de13b21f3f70ef6
child 3491 81f27df7d581e16ba97ef699a91b1082a354417b
child 3634 d0b11a9ca29d7ad276ff71e30b074a3a10c47381
push idunknown
push userunknown
push dateunknown
reviewersstandard8
bugs482131
Bug 482131 - UTF-8 encoded invitation subject not displayed correctly; r=standard8
calendar/itip/calItipEmailTransport.js
--- a/calendar/itip/calItipEmailTransport.js
+++ b/calendar/itip/calItipEmailTransport.js
@@ -296,22 +296,21 @@ calItipEmailTransport.prototype = {
         try {
             function encodeUTF8(text) {
                 return convertFromUnicode("UTF-8", text).replace(/(\r\n)|\n/g, "\r\n");
             }
             function encodeMimeHeader(header) {
                 let mimeConverter = Components.classes["@mozilla.org/messenger/mimeconverter;1"]
                                               .createInstance(Components.interfaces.nsIMimeConverter);
                 let fieldNameLen = (header.indexOf(": ") + 2);
-                return (header.substring(0, fieldNameLen) +
-                        mimeConverter.encodeMimePartIIStr_UTF8(header.substring(fieldNameLen),
-                                                               false,
-                                                               "UTF-8",
-                                                               fieldNameLen,
-                                                               72 - fieldNameLen));
+                return mimeConverter.encodeMimePartIIStr_UTF8(header,
+                                                              false,
+                                                              "UTF-8",
+                                                              fieldNameLen,
+                                                              Components.interfaces.nsIMimeConverter.MIME_ENCODED_WORD_SIZE);
             }
 
             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;