From 15b3ae1f9e254ed7ad073e6214e709be6d8f941e Mon Sep 17 00:00:00 2001 From: "ftang%netscape.com" Date: Fri, 19 Oct 2001 20:58:22 +0000 Subject: [PATCH] fix bug 93343 so we can display UTF-16 and UTF-32. r=harishd sr=vidur. git-svn-id: svn://10.0.0.236/trunk@105808 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsParser.cpp | 11 ++++++----- mozilla/parser/htmlparser/src/nsParser.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index c13c72e47eb..dee54a0a21e 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -2392,11 +2392,12 @@ ParserWriteFunc(nsIInputStream* in, // Only continue if it's a recognized charset and not // one of a designated set that we ignore. if (NS_SUCCEEDED(result) && - !preferred.Equals(NS_LITERAL_STRING("UTF-16")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-16BE")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-16LE")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-32BE")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-32LE"))) { + ((kCharsetFromByteOrderMark == guessSource) || + (!preferred.Equals(NS_LITERAL_STRING("UTF-16")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-16BE")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-16LE")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-32BE")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-32LE"))))) { guess.Assign(preferred); pws->mParser->SetDocumentCharset(guess, guessSource); pws->mParser->SetSinkCharset(guess); diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index c13c72e47eb..dee54a0a21e 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -2392,11 +2392,12 @@ ParserWriteFunc(nsIInputStream* in, // Only continue if it's a recognized charset and not // one of a designated set that we ignore. if (NS_SUCCEEDED(result) && - !preferred.Equals(NS_LITERAL_STRING("UTF-16")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-16BE")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-16LE")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-32BE")) && - !preferred.Equals(NS_LITERAL_STRING("UTF-32LE"))) { + ((kCharsetFromByteOrderMark == guessSource) || + (!preferred.Equals(NS_LITERAL_STRING("UTF-16")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-16BE")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-16LE")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-32BE")) && + !preferred.Equals(NS_LITERAL_STRING("UTF-32LE"))))) { guess.Assign(preferred); pws->mParser->SetDocumentCharset(guess, guessSource); pws->mParser->SetSinkCharset(guess);