Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

Timeline for answer to Is the "charset" attribute required with HTML5? by hrunting

Current License: CC BY-SA 3.0

Post Revisions

10 events
when toggle format what by license comment
Feb 20, 2020 at 1:50 comment added Elijah M But, the W3C link @hrunting provided states that You should always specify the encoding used for an HTML or XML page.
Feb 3, 2013 at 6:47 comment added Jukka K. Korpela @twiz, a common scenario is a UTF-8 encoded document with BOM.
Feb 3, 2013 at 5:57 vote accept twiz
Feb 3, 2013 at 5:57 comment added twiz @JukkaK.Korpela I don't know a lot about encoding, so just wondering, what would be an example of a common scenario where the charset might be left out?
Feb 3, 2013 at 5:37 comment added Jukka K. Korpela @twiz, it is necessary to use a meta tag to declare encoding when the server sends a Content-Type header without charset parameter and you cannot affect this (and you are not using UTF-8). This is not an uncommon scenario. Moreover, the meta tag is relevant if a page is saved locally by a user. (When opened later, there will be no HTTP headers.)
Feb 3, 2013 at 4:51 comment added twiz That's really interesting. I would have thought that the purpose of the meta tag would be to override everything else. It seems like it would actually be rather difficult to have a situation where the meta tag would be necessary. Am I missing something?
Feb 3, 2013 at 4:38 history edited hrunting CC BY-SA 3.0
Added link to W3C rules for preference order
Feb 3, 2013 at 4:36 comment added hrunting HTTP header, BOM, followed by meta tag. I'll update the answer with a link I found from W3C answering this very question.
Feb 3, 2013 at 4:24 comment added twiz So what would be the order of precedence if the Content-type, BOM, and <meta charset=""> all had different values?
Feb 3, 2013 at 4:15 history answered hrunting CC BY-SA 3.0