зеркало из https://github.com/mozilla/gecko-dev.git
Bug 190302: Set correct characterset for XSLT generated pages.
r=Pike sr=peterv
This commit is contained in:
Родитель
ced3249287
Коммит
39a639c80c
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче