invalid charset detection when a meta contains both a "charset" and a "content" attribute
Reported by
pere.j...@gmail.com,
Jun 21 2018
|
||||
Issue description
UserAgent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Example URL:
Steps to reproduce the problem:
1. Copy and paste the following line in an html file:
<meta content='charset=UTF-8' charset='WINDOWS-1252' http-equiv='content-type'>
2. Open the file
3. Enter "document.characterSet" in the web console and press enter
What is the expected behavior?
"windows-1252" should appear in the console
What went wrong?
"UTF-8" appears in the console.
The W3C specification is clear that the encoding specified in the "charset" attribute should have precedence over the one in the "content" attribute :
> If the element has a charset attribute [...] Otherwise, if the element has an http-equiv attribute [...]
https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inhead
Does it occur on multiple sites: N/A
Is it a problem with a plugin? N/A
Did this work before? N/A
Does this work in other browsers? N/A
Chrome version: Chromium 67.0.3396.79 (Developer Build) Fedora Project (64-bit) Revision 161bdad7314804dc8c72f850396fcd696e8863e8-refs/branch-heads/3396@{#755} Channel: n/a
OS Version: fedora
Flash Version:
,
Jun 21 2018
,
Jun 22 2018
Firefox works correctly.
,
Aug 13
,
Aug 14
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/cd71c5f420742ed40a40c02fb89a17e1ba25c694 commit cd71c5f420742ed40a40c02fb89a17e1ba25c694 Author: Amos Lim <eui-sang.lim@samsung.com> Date: Tue Aug 14 05:58:20 2018 Fix invalid charset detection in a meta element Fix invalid charset detection when a meta contains both a "charset" and a "content" attribute. The encoding specified in the "charset" attribute should have precedence over the one in the "content" attribute. https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inhead Bug: 855047 Change-Id: I79306fc0bff8f094800a989d8d548bd94b96b5eb Reviewed-on: https://chromium-review.googlesource.com/1172462 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Amos Lim <eui-sang.lim@samsung.com> Cr-Commit-Position: refs/heads/master@{#582845} [add] https://crrev.com/cd71c5f420742ed40a40c02fb89a17e1ba25c694/third_party/WebKit/LayoutTests/external/wpt/html/syntax/parsing/meta-inhead-insertion-mode.html [modify] https://crrev.com/cd71c5f420742ed40a40c02fb89a17e1ba25c694/third_party/blink/renderer/core/html/parser/html_parser_idioms.cc |
||||
►
Sign in to add a comment |
||||
Comment 1 by dtapu...@chromium.org
, Jun 21 2018