What is the difference between the charset in http header and html meta?

You can send the charset both in the http response headers and also you can define a charset in the html file you have sent..

What happens if these 2 are different charsets? How does the browser use the charset for what it received in the http headers and where does it matter what charset it provided in the html file itself?


The HTML 4.01 specification clearly says, in 5.2.2 Specifying the character encoding, that information in an HTTP header has precedence over a meta tag. HTML5 PR does not change this, but it adds, reflecting browser practice, in Determining the character encoding that both of them are overridden by a Byte Order Mark (BOM) at the start of the HTML document (so if you have saved your .html file with “Save as UTF-8 with BOM”, it will be treated as UTF-8 no matter what).

A meta tag that specifies character encoding takes effect if the information is not provided in an HTTP header or with a BOM. A server might not include charset parameter in the Content-Type header, or the HTML document might be opened locally so that there are no HTTP headers at all. When a user saves an HTML document in his own device, the HTTP headers are not saved. This is the main reason for using a meta tag to specify character encoding; but it should then specify the correct encoding of course.

Need Your Help

Optimizing a very simple O(n^3) algorithm to a O(n^2) algorithm.

algorithm time big-o complexity-theory

I've been stuck on this question for a very long time. Let X, Y, and Z be sets of n integers. Let k be any integer. The question "Can you find an x in X, y in Y and z in Z such that x + y + z = k" ...

Android listview update data when scroll view

android android-listview

I have 1 listView, items of listivew about : button translate, text translate.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.