From 4bdfce9548605bdd45bb22cd673b9df831a95bb1 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Mon, 19 Apr 2004 20:12:53 +0000 Subject: [PATCH] Make sure to parse the data as UTF-8, since we serialized it as UTF8. Bug 240717, r+sr=jst --- extensions/xmlextras/base/src/nsDOMParser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/xmlextras/base/src/nsDOMParser.cpp b/extensions/xmlextras/base/src/nsDOMParser.cpp index 61e3ac907d35..4731d467bdc5 100644 --- a/extensions/xmlextras/base/src/nsDOMParser.cpp +++ b/extensions/xmlextras/base/src/nsDOMParser.cpp @@ -86,6 +86,7 @@ public: protected: nsCString mContentType; + nsCString mContentCharset; nsresult mStatus; PRInt32 mContentLength; nsCOMPtr mURI; @@ -194,12 +195,12 @@ NS_IMETHODIMP nsDOMParserChannel::SetContentType(const nsACString &aContentType) /* attribute ACString contentCharset; */ NS_IMETHODIMP nsDOMParserChannel::GetContentCharset(nsACString &aContentCharset) { - aContentCharset.Truncate(); + aContentCharset = mContentCharset; return NS_OK; } NS_IMETHODIMP nsDOMParserChannel::SetContentCharset(const nsACString &aContentCharset) { - return NS_ERROR_NOT_IMPLEMENTED; + mContentCharset = aContentCharset; } /* attribute long contentLength; */ @@ -547,6 +548,7 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream, if (principal) { channel->SetOwner(principal); } + parserChannel->SetContentCharset(nsDependentCString(charset)); nsCOMPtr request = NS_STATIC_CAST(nsIRequest*, parserChannel); // Tell the document to start loading