Skip to content

Stop treating ';' as part of an unquoted meta charset - #608

Open
ekanshul wants to merge 1 commit into
html5lib:masterfrom
ekanshul:fix/meta-charset-semicolon
Open

ekanshul wants to merge 1 commit into
html5lib:masterfrom
ekanshul:fix/meta-charset-semicolon

Conversation

@ekanshul

Copy link
Copy Markdown

Unquoted charset values in a meta Content-Type currently stop only at ASCII whitespace. The HTML spec also treats ; as a terminator, so this markup:

<meta http-equiv="Content-Type" content="charset=iso-8859-2;text/html">

was parsed as the encoding name iso-8859-2;text/html and fell back to windows-1252.

ContentAttrParser.parse() now stops at whitespace or ;, matching https://html.spec.whatwg.org/#algorithm-for-extracting-a-character-encoding-from-a-meta-element.

Fixes #92

The HTML spec stops an unquoted charset at ASCII whitespace or a
semicolon. ContentAttrParser only stopped at spaces, so values like
charset=iso-8859-2;text/html were treated as an invalid encoding.

Fixes html5lib#92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charset in meta content does not correctly parse for trailing semi-colon

1 participant