Make sure to parse the data as UTF-8, since we serialized it as UTF8. Bug

240717, r+sr=jst
This commit is contained in:
bzbarsky%mit.edu 2006-04-20 03:38:58 +00:00
Родитель d2904cd7c1
Коммит 2cff2b7990
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -86,6 +86,7 @@ public:
protected: protected:
nsCString mContentType; nsCString mContentType;
nsCString mContentCharset;
nsresult mStatus; nsresult mStatus;
PRInt32 mContentLength; PRInt32 mContentLength;
nsCOMPtr<nsIURI> mURI; nsCOMPtr<nsIURI> mURI;
@ -194,12 +195,12 @@ NS_IMETHODIMP nsDOMParserChannel::SetContentType(const nsACString &aContentType)
/* attribute ACString contentCharset; */ /* attribute ACString contentCharset; */
NS_IMETHODIMP nsDOMParserChannel::GetContentCharset(nsACString &aContentCharset) NS_IMETHODIMP nsDOMParserChannel::GetContentCharset(nsACString &aContentCharset)
{ {
aContentCharset.Truncate(); aContentCharset = mContentCharset;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsDOMParserChannel::SetContentCharset(const nsACString &aContentCharset) NS_IMETHODIMP nsDOMParserChannel::SetContentCharset(const nsACString &aContentCharset)
{ {
return NS_ERROR_NOT_IMPLEMENTED; mContentCharset = aContentCharset;
} }
/* attribute long contentLength; */ /* attribute long contentLength; */
@ -547,6 +548,7 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
if (principal) { if (principal) {
channel->SetOwner(principal); channel->SetOwner(principal);
} }
parserChannel->SetContentCharset(nsDependentCString(charset));
nsCOMPtr<nsIRequest> request = NS_STATIC_CAST(nsIRequest*, parserChannel); nsCOMPtr<nsIRequest> request = NS_STATIC_CAST(nsIRequest*, parserChannel);
// Tell the document to start loading // Tell the document to start loading