Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to check the usage of charset meta tag #199

Merged
merged 1 commit into from
May 15, 2017
Merged

Add rule to check the usage of charset meta tag #199

merged 1 commit into from
May 15, 2017

Conversation

alrra
Copy link
Contributor

@alrra alrra commented May 11, 2017

Fix #81

@alrra alrra requested review from molant and sarvaje May 11, 2017 16:33
const isHTMLDocument = (targetURL: string, responseHeaders: object) => {

// If it's a local file, just presume it's a HTML document.
// TODO: Change this!
Copy link
Contributor Author

@alrra alrra May 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@molant When working with local files, rules will need a way to know what type of file they are dealing with.

(and I think this will became more important in the "text editor scenario")

Sending just the `Content-Type` HTTP header is in general ok, but it's
usually a good idea to also add the charset meta tag because:

* Server configurations might change (or servers might not send the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a trailing space in this line. The tests are failing because of this hehehe

@molant
Copy link
Member

molant commented May 12, 2017

@alrra I think this is one of those rules that should check the browserlist for some of it. As you say in the documentation, modern browsers alias utf8 to utf-8. It will be nice if we could identify when they started aliasing it (at least for IE which I believe is the one with any meaningful market share to be a problem).

@alrra
Copy link
Contributor Author

alrra commented May 12, 2017

I think this is one of those rules that should check the browserlist for some of it.

My opinion is that we should stick to utf-8 as:

  1. besides older browsers, there may be other agents (non-browsers) that may scan/get the content and may not have the alias.

  2. the markup validator will also complain about bad values such as utf8:

@alrra
Copy link
Contributor Author

alrra commented May 15, 2017

@molant Updated the docs.

@molant molant merged commit 758cb3c into webhintio:master May 15, 2017
@alrra alrra deleted the fix-81 branch May 15, 2017 14:57
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.

3 participants