# How many sites specify Charset in headers?

**URL:** https://discuss.httparchive.org/t/how-many-sites-specify-charset-in-headers/189
**Category:** Analysis
**Created:** [March 7, 2014, 9:50pm UTC](https://discuss.httparchive.org/t/how-many-sites-specify-charset-in-headers/189 "2014-03-07T21:50:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![stevesoudersorg](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/stevesoudersorg/32/1293_2.png) [@stevesoudersorg](https://discuss.httparchive.org/u/stevesoudersorg)
#### Post date: [March 7, 2014, 9:50pm UTC](https://discuss.httparchive.org/t/how-many-sites-specify-charset-in-headers/189/1 "2014-03-07T21:50:00Z")

</div>

Ilya recently [tweeted](https://twitter.com/igrigorik/status/442008301027356672) about Eric Lawrence’s important [article](http://blogs.msdn.com/b/ieinternals/archive/2011/07/18/optimal-html-head-ordering-to-avoid-parser-restarts-redownloads-and-improve-performance.aspx) about making sure to specify a Charset for HTML documents. Without it the browser may have to restart parsing the HTML or display it with errors. As Eric says, “for functionality and performance reasons, it is a best-practice to specify the encoding using HTTP response headers.”

Specifying the Charset is done within the Content-Type response header. Here’s a quick check on how many websites do this.

The number of HTML documents in the most recent crawl is 291,356:

````sql
select count(*) as num from httparchive:runs.2014_02_01_requests 
where firsthtml=true```

Of those, the number that specify Charset is 194,368:

````

select count(\*) as num from httparchive:runs.2014\_02\_01\_requests  
where firsthtml=true and resp\_content\_type like “%charset%”```

Conclusion: Across the top ~300K websites 67% specify Charset in an HTTP header.

---

<div class="post-metadata">

### Author: ![fhoffa](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/fhoffa/32/750_2.png) [@fhoffa](https://discuss.httparchive.org/u/fhoffa)
#### Post date: [March 14, 2014, 3:47pm UTC](https://discuss.httparchive.org/t/how-many-sites-specify-charset-in-headers/189/2 "2014-03-14T15:47:22Z")

</div>

> [@stevesoudersorg](#):
>
> select count(\*) as num from httparchive:runs.2014\_02\_01\_requests  
> where firsthtml=true and resp\_content\_type like “%charset%”

Just for fun, in one query:

```sql
select
  count(*) as num,
  resp_content_type like "%charset%" has_charset,
  ratio_to_report(num) over() ratio
 from httparchive:runs.2014_02_01_requests 
 where firsthtml=true
 group by has_charset

```
