“Content-type: text/html; charset=iso-8859-1”
Content-Type header with charset is used for telling browser which type of content you have to show and which additional encoding is applied to the content.
RFC 2616 HTTP 1.1:
When an entity-body is included with a message, the data type of that
body is determined via the header fields Content-Type and Content-
Encoding. These define a two-layer, ordered encoding model:
entity-body := Content-Encoding( Content-Type( data ) )
Content-Type specifies the media type of the underlying data.
Content-Encoding may be used to indicate any additional content codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. There is no default encoding.
Any HTTP/1.1 message containing an entity-body should include a Content-Type header field defining the media type of that body.
You can specify content type by adding:
<meta name=’Content-Type’ Content=’text/html; charset:UTF-8′ />
between <head> and </head> tags.
This will set your content type in your document. But some browser like Mozilla do not accepts content-type correctly when set by this method. So you should set content type using server setting also. Server side setting will set default content type and encoding for all documents. You can set content type and encoding document wise using server side scripts also.
In PHP add this line at the top of script:
header (‘Content-type: text/html; charset=iso-8859-1’);
Some time you may have noticed in a document that junk character is coming. If this is the case with your document then you can control it. For multiple languages UTF-8 is the best choice. General accepted encoding is ISO-8859-1.
What to do if your document is not showing correctly after using <meta> in html and header(‘Content-Type:….’) from server side server.
I have simple test based on trial and error method that will work for you. In Internet Explorer: View -> Encoding and select encoding type one by one. In Firefox, View->Character Encoding and select encoding type one by one. One encoding or multiple encoding suits to you. Now after identifying content encoding you can use that at both places.
In Firefox you get additional information about any document by using Tools-> Page Info.
Here you will get info. About all Meta used, type, Cache source, render Mode, Encoding, Size, Referring URL, Modified and Expire. This was just example. You will also get form, links, media and security informations.