12085: Add meta tag to specify charset

git-svn-id: svn://10.0.0.236/trunk@45559 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
akkana%netscape.com
1999-09-01 23:36:57 +00:00
parent 8cd295ac02
commit 9d858f00b6
2 changed files with 52 additions and 16 deletions

View File

@@ -705,10 +705,12 @@ nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){
* @return PR_TRUE if successful.
*/
NS_IMETHODIMP
nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){
nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode)
{
eHTMLTags tag = (eHTMLTags)aNode.GetNodeType();
if (tag == eHTMLTag_head)
AddStartTag(aNode);
return NS_OK;
}
@@ -930,6 +932,26 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode)
if (IndentChildren(tag))
mIndent++;
if (tag == eHTMLTag_head)
{
if (mCharsetOverride.Length() > 0)
{
Write(NS_LINEBREAK);
Write("<meta http-equiv=\"Content-Type\" content=\"text/html\"; charset=\"");
Write(mCharsetOverride);
Write("\">");
Write(NS_LINEBREAK);
}
if(mDoHeader)
{
Write(gHeaderComment);
Write(NS_LINEBREAK);
Write(gDocTypeHeader);
Write(NS_LINEBREAK);
}
}
}
@@ -1240,14 +1262,10 @@ nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){
* @update 5/7/98 gess
*/
NS_IMETHODIMP
nsHTMLContentSinkStream::WillBuildModel(void){
nsHTMLContentSinkStream::WillBuildModel(void)
{
mTabLevel=-1;
if(mDoHeader) {
Write(gHeaderComment);
Write(NS_LINEBREAK);
Write(gDocTypeHeader);
Write(NS_LINEBREAK);
}
return NS_OK;
}