Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Validator doesn't follow 'get an encoding' in WHATWG Encoding spec

Open
#104 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
backend

Research direction

Start by reading validator.htmlparser.io.Encoding, especially toNameKey, and then inspect validator.encoding.Encoding.forName to determine how the two lookup paths handle invalid labels. Use the reported meta charset examples as regression cases and confirm that labels with spaces, percent escapes, or unsupported suffixes are rejected according to the WHATWG Encoding specification.

Written by the indexing model from the issue text.

Description

'<meta charset="iso-8859- 2">'
or
'<meta charset="iso-8859-%2">'
returns
'Error Internal encoding declaration [...] disagrees with the actual encoding of the document (utf-8).'

While invald encoding name e.g '<meta charset=iso-8859-2a>'
returns
'Error: Internal encoding declaration named an unsupported chararacter encoding iso-8859-2a.'

From the spec, both cases are invalid encoding labels.
https://encoding.spec.whatwg.org/#names-and-labels

It seems
'toNameKey' in validator.htmlparser.io.Encoding
is just skipping invalid characters.

I'm not certain 'forName' in validator.encoding.Encoding
is related or not.

Dominant language
Java
Stars
65
Forks
29
Avg merge
11d 21h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from validator/htmlparser

All issues in validator/htmlparser

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.