Closed Bug 1697060 Opened 1 year ago Closed 1 year ago

"charset=none" in the http-equiv meta tag will cause the page to be requested twice

Categories

(Core :: Internationalization, defect)

Firefox 86
defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: online-update, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0

Steps to reproduce:

I'm trying out a new web server.
The statics for one specific page were twice as high as they were supposed to be when using Firefox. Using IE, they were exactly as expected.
Debugging showed, that for each refresh of the page, it was requested TWICE.
Result of analysis:
The head of the page contained <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=none">
Replacing "charset=none" by "charset=UTF-8" or removing the line altogether solved the problem, the page was then correctly loaded just once.

Actual results:

The unspecified charset in the meta tag caused Firefox (and only Firefox, not any other browsers I tried) to request the page from the server twice upon a refresh.

Expected results:

For one refresh, the page should have been requested from the server only once.

The Bugbug bot thinks this bug should belong to the 'Core::Networking: HTTP' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Networking: HTTP
Product: Firefox → Core

I can't reproduce with the following html file and Python's SimpleHttpServer.

<!DOCTYPE html>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=none">
</head>
<body>

test

</body>
</html>

I think this might have something to do with the content of the html file. Could you provide us a simple test case that can demonstrate this problem? Thanks.

Flags: needinfo?(online-update)

I cut the problematic file down bit by bit, trying each step if the error persisted.

One thing I found: The problem only occurs if a non-encoded special char exists in the file, e.g. in "naïve". So far that makes sense.

The file also contains numerous style elements, all of them unused after stripping down the body.
Some of these I could remove with no effect on the error, but others not.
As below, I get the error. If I remove any of the remaining style elements, the error is gone. Very mysterious.

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=none">
<STYLE TYPE="text/css">
body {
margin: 0;
background-color: #D0D8CD;
scrollbar-base-color: #C9D1C6;
color: #000000;
}
A:link {
text-decoration: underline;
color: #696A97;
}
A:hover {
text-decoration: underline;
color: #CC3300;
}
A:visited {
text-decoration: underline;
color: #696A67;
}
p, li, dt, dd {
font-family: "Arial", sans-serif;
font-size: 10pt;
text-align: left;
color: #000000;
}
h1 {
font-family: "Arial", sans-serif;
font-size: 15pt;
text-align: center;
color: #4A735A;
}
h2 {
font-family: "Arial", sans-serif;
font-size: 13pt;
text-align: left;
color: #4A735A;
}
h3 {
font-family: "Arial", sans-serif;
font-size: 11pt;
text-align: left;
color: #000000;
}
.tleft {
margin-left: 6px;
font-family: "Tahoma", sans-serif;
font-size: 8pt;
text-align: left;
}
.tright {
margin-right: 6px;
font-family: "Tahoma", sans-serif;
font-size: 8pt;
text-align: right;
}
</STYLE>
</HEAD>

<BODY>
naïve
</BODY>
</HTML>```

(In reply to Hendrik from comment #3)
I didn't intend to post this, please ignore

Only comment 4 is relevant

Attachment #9208112 - Attachment is obsolete: true
Flags: needinfo?(online-update)
Attachment #9208112 - Attachment mime type: text/plain → text/html

I can't still reproduce the issue, but the text is rendered as naïve (mojibake).

The reason is shown in the web console:

An unsupported character encoding was declared for the HTML document using a meta tag. The declaration was ignored.

Why are you using a wrong encoding label in the first place?

I think auto-detector causes the issue.

Component: Networking: HTTP → Internationalization
Regressed by: 1551276
Has Regression Range: --- → yes

The files aren't mine and I don't have any influence on their content.

If the double-dotted i is shown as "ï" for you, your webserver must be using a different encoding from mine. I'll check that tomorrow, as I have full influence on that.

I think that you'll agree, though, that even though such a character should not be in the html file, it also definitely should not cause the page to be requested twice if it is.

(In reply to Masatoshi Kimura [:emk] from comment #7)

I think auto-detector causes the issue.

Thanks for triaging this to the right component!

This is by design if the guess made at the end of the stream doesn't match the guess made when the first 1024 bytes of the stream have been seen. Chances are that removing the bogus meta removes just enough bytes to move your non-ASCII word to within the first 1024 bytes.

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.