Checking in dbradley@netscape.com's fix for bug 198995. Make sure we default to the default charset if the server gives us one we don't know. r=jst@netscape.com, sr=peterv@netscape.com

This commit is contained in:
jst%netscape.com 2003-03-26 01:26:38 +00:00
Родитель fb07bbed4d
Коммит 6d5b687996
1 изменённых файлов: 3 добавлений и 3 удалений

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

@ -765,16 +765,17 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
nsCOMPtr<nsIChannel> channel;
channel = do_QueryInterface(req);
nsAutoString charset;
if (channel) {
nsCAutoString charsetVal;
rv = channel->GetContentCharset(charsetVal);
if (NS_SUCCEEDED(rv)) {
characterSet = NS_ConvertASCIItoUCS2(charsetVal);
charset = NS_ConvertASCIItoUCS2(charsetVal);
nsCOMPtr<nsICharsetAlias> calias(do_GetService(kCharsetAliasCID,&rv));
if(NS_SUCCEEDED(rv) && calias) {
rv = calias->GetPreferred(characterSet, preferred);
rv = calias->GetPreferred(charset, preferred);
if(NS_SUCCEEDED(rv)) {
characterSet = preferred;
@ -784,7 +785,6 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
}
if (NS_FAILED(rv) || characterSet.IsEmpty()) {
nsAutoString charset;
// Check the charset attribute to determine script charset.
request->mElement->GetCharset(charset);
if (!charset.IsEmpty()) {