Use a better sourcelevel when setting charset through xsl:output element. Also make sure to use the proper form when setting the charset.
r/sr=bz
This commit is contained in:
Родитель
03ee213afd
Коммит
33cb3427a2
|
@ -49,6 +49,7 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
|
||||
|
@ -187,10 +188,17 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
|||
|
||||
// Set the charset
|
||||
if (!mOutputFormat.mEncoding.IsEmpty()) {
|
||||
doc->SetDocumentCharacterSet(
|
||||
NS_LossyConvertUTF16toASCII(mOutputFormat.mEncoding));
|
||||
NS_LossyConvertUTF16toASCII charset(mOutputFormat.mEncoding);
|
||||
nsCAutoString canonicalCharset;
|
||||
nsCOMPtr<nsICharsetAlias> calias =
|
||||
do_GetService("@mozilla.org/intl/charsetalias;1");
|
||||
|
||||
if (calias &&
|
||||
NS_SUCCEEDED(calias->GetPreferred(charset, canonicalCharset))) {
|
||||
doc->SetDocumentCharacterSet(canonicalCharset);
|
||||
doc->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc->SetDocumentCharacterSet(sourceDoc->GetDocumentCharacterSet());
|
||||
doc->SetDocumentCharacterSetSource(
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsIDocumentTransformer.h"
|
||||
#include "nsICSSLoader.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
|
||||
extern nsINameSpaceManager* gTxNameSpaceManager;
|
||||
|
||||
|
@ -738,10 +739,17 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, PRInt32 aNsID,
|
|||
|
||||
// Set the charset
|
||||
if (!mOutputFormat.mEncoding.IsEmpty()) {
|
||||
doc->SetDocumentCharacterSet(
|
||||
NS_LossyConvertUTF16toASCII(mOutputFormat.mEncoding));
|
||||
NS_LossyConvertUTF16toASCII charset(mOutputFormat.mEncoding);
|
||||
nsCAutoString canonicalCharset;
|
||||
nsCOMPtr<nsICharsetAlias> calias =
|
||||
do_GetService("@mozilla.org/intl/charsetalias;1");
|
||||
|
||||
if (calias &&
|
||||
NS_SUCCEEDED(calias->GetPreferred(charset, canonicalCharset))) {
|
||||
doc->SetDocumentCharacterSet(canonicalCharset);
|
||||
doc->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the mime-type
|
||||
if (!mOutputFormat.mMediaType.IsEmpty()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче