Bug 692767 - about:home shows tabs from last time with wrong encoding, non-ASCII characters are broken [r=mbrubeck]

This commit is contained in:
Mark Finkle 2011-10-07 15:35:41 -04:00
parent a1ace9621b
commit 1b96b92163

View File

@ -193,10 +193,15 @@
return;
}
let content = NetUtil.readInputStreamToString(aStream, aStream.available()) || "";
let fileSize = aStream.available();
let cvstream = Cc["@mozilla.org/intl/converter-input-stream;1"].createInstance(Ci.nsIConverterInputStream);
cvstream.init(aStream, "UTF-8", fileSize, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
let content = {};
cvstream.readString(fileSize, content);
cvstream.close();
aStream.close();
aCallback(content.replace(/\r\n?/g, "\n"));
aCallback(content.value.replace(/\r\n?/g, "\n"));
});
}