Make createDocument-created documents UTF-8. Bug 464958, r+sr=sicking, a=dveditz

git-svn-id: svn://10.0.0.236/trunk@255083 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2008-11-18 01:10:08 +00:00
parent 2a8480b7e8
commit d1cfa23b9b
2 changed files with 5 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ var tests = [
[ frameDoc("five"), "UTF-8", "UTF-8", null ],
[ frameDoc("six"), "UTF-8", "UTF-8", "UTF-8"],
[ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],
[ createDoc, "ISO-8859-1", null, null ],
[ createDoc, "UTF-8", null, null ],
[ xhrDoc(4), "UTF-8", "UTF-8", null ],
[ xhrDoc(5), "UTF-8", "UTF-8", "UTF-8" ],
[ xhrDoc(6), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],

View File

@@ -133,6 +133,10 @@ NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
doc->SetPrincipal(aPrincipal);
doc->SetBaseURI(aBaseURI);
// XMLDocuments and documents "created in memory" get to be UTF-8 by default,
// unlike the legacy HTML mess
doc->SetDocumentCharacterSet(NS_LITERAL_CSTRING("UTF-8"));
if (aDoctype) {
nsCOMPtr<nsIDOMNode> tmpNode;
rv = doc->AppendChild(aDoctype, getter_AddRefs(tmpNode));