rem: var postStream = Components.classes["@mozilla.org/io/string-input-stream;1"] .createInstance(Components.interfaces.nsIStringInputStream); postStream.setData(icsStr, icsStr.length); uploadChannel.setUploadStream(postStream, "text/calendar", -1); 
add:     var pipe = Components.classes["@mozilla.org/pipe;1"] .createInstance(Components.interfaces.nsIPipe); pipe.init(true, true, 0, 0, null)      var convStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .getService(Components.interfaces.nsIConverterOutputStream); convStream.init(pipe.outputStream, 'UTF-8', 0, 0x0000); try { convStream.writeString(icsStr); } catch(e) { this.mObserver.onError(e.result, e.toString()); } convStream.close();  uploadChannel.setUploadStream(pipe.inputStream, "text/calendar", -1);  
context:             onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail)            {                // All events are returned. Now set up a channel and a                // streamloader to upload.                // Will call onStopRequest when finised.                var icsStr = calComp.serializeToICS();                var ioService = Components.classes["@mozilla.org/network/io-service;1"]                                          .getService(Components.interfaces.nsIIOService);                var channel = ioService.newChannelFromURI(fixupUri(savedthis.mUri));                channel.notificationCallbacks = savedthis;                var uploadChannel = channel.QueryInterface(Components.interfaces.nsIUploadChannel);                var postStream = Components.classes["@mozilla.org/io/string-input-stream;1"]                                           .createInstance(Components.interfaces.nsIStringInputStream);                postStream.setData(icsStr, icsStr.length);                uploadChannel.setUploadStream(postStream, "text/calendar", -1);                channel.asyncOpen(savedthis, savedthis);            },
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/84ba0f6b23fb23c850f016df48e9bb34d4fcd4f7/calICSCalendar.js/buggy/calendar/providers/ics/calICSCalendar.js