IIS 7 and Above
How to set charset in IIS7.0?
Last post Feb 23, 2009 05:18 PM by peaceable_whale
Feb 20, 2009 02:08 PM|neha.noma|LINK
I want to change the Content-Type header to include charset info on IIS 7.0.
By default I get the ==> Content-Type: text/html
It does not include the charset information, even though in my page I have below tag set:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Please let me know how to override Web Server's default setting.
I tried adding custom HTTP Response header for Content-type: image/jpeg;charset=UTF-8
Now I receive header like this in response==>
Content-Type: content=text/html,image/jpeg; charset=UTF-8
This way it appends my HTTP Response Header setting to the default set. But now the page does not get render instead it asks for downloading the file.
Am I missing something? Please guide.
Feb 20, 2009 03:40 PM|HostingASPNet|LINK
Should be "text/html;", not "image/jpeg;".
Feb 23, 2009 07:15 AM|neha.noma|LINK
Just like that I gave image/jpeg as it was appending in in text/html. Even text/html is also giving the same problem. Where does the default text/html comes from, so that I can go and directly edit it.
Feb 23, 2009 05:18 PM|peaceable_whale|LINK
Please create a file called "web.config" in your website with the following code: (if there has already been such a file, please only add the
<?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer> <staticContent> <remove fileExtension=".html" /> <mimeMap fileExtension=".html" mimeType="text/html; charset=UTF-8" /> </staticContent> </system.webServer></configuration>