Bug 190302: Set correct characterset for XSLT generated pages.

r=Pike sr=peterv
This commit is contained in:
sicking%bigfoot.com 2003-10-30 18:44:14 +00:00
Родитель ced3249287
Коммит 39a639c80c
3 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -349,6 +349,10 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
aNewDoc->Reset(channel, loadGroup);
aNewDoc->SetBaseURL(sourceDoc->GetBaseURL());
// Copy charset
aNewDoc->SetDocumentCharacterSet(sourceDoc->GetDocumentCharacterSet());
aNewDoc->SetDocumentCharacterSetSource(
sourceDoc->GetDocumentCharacterSetSource());
}
#endif /* TX_EXE */

Просмотреть файл

@ -48,6 +48,7 @@
#include "nsIDocumentTransformer.h"
#include "nsNetUtil.h"
#include "nsIDOMNSDocument.h"
#include "nsIParser.h"
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
@ -182,6 +183,18 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
doc->Reset(channel, loadGroup);
doc->SetBaseURL(sourceDoc->GetBaseURL());
// Set the charset
if (!mOutputFormat.mEncoding.IsEmpty()) {
doc->SetDocumentCharacterSet(
NS_LossyConvertUTF16toASCII(mOutputFormat.mEncoding));
doc->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
}
else {
doc->SetDocumentCharacterSet(sourceDoc->GetDocumentCharacterSet());
doc->SetDocumentCharacterSetSource(
sourceDoc->GetDocumentCharacterSetSource());
}
// Notify the contentsink that the document is created
nsCOMPtr<nsITransformObserver> observer = do_QueryReferent(mObserver);
if (observer) {

Просмотреть файл

@ -725,6 +725,13 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, PRInt32 aNsID,
// Reset and set up the document
URIUtils::ResetWithSource(doc, aSourceDocument);
// Set the charset
if (!mOutputFormat.mEncoding.IsEmpty()) {
doc->SetDocumentCharacterSet(
NS_LossyConvertUTF16toASCII(mOutputFormat.mEncoding));
doc->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
}
// Set the mime-type
if (!mOutputFormat.mMediaType.IsEmpty()) {
doc->SetContentType(mOutputFormat.mMediaType);