Search
Home IIS.NET Forums IIS 7 & IIS 8 General How to set charset in IIS7.0?
Last post Feb 23, 2009 04:18 PM by peaceable_whale
28 Posts
Feb 20, 2009 01:08 PM|LINK
Hi Team,
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.
Thanks,
Neha
Host Headers HTTP IIS HttpHandlers Http Handlers iis 7
734 Posts
Feb 20, 2009 02:40 PM|LINK
Hello,
Should be "text/html;", not "image/jpeg;".
Regards
Feb 23, 2009 06:15 AM|LINK
HI,
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.
97 Posts
Feb 23, 2009 04:18 PM|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
remove
mimeMap
<?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>
neha.noma
28 Posts
How to set charset in IIS7.0?
Feb 20, 2009 01:08 PM|LINK
Hi Team,
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.
Thanks,
Neha
Host Headers HTTP IIS HttpHandlers Http Handlers iis 7
HostingASPNe...
734 Posts
Re: How to set charset in IIS7.0?
Feb 20, 2009 02:40 PM|LINK
Hello,
Should be "text/html;", not "image/jpeg;".
Regards
Free ASP.NET Examples and source code.
neha.noma
28 Posts
Re: How to set charset in IIS7.0?
Feb 23, 2009 06:15 AM|LINK
HI,
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.
peaceable_wh...
97 Posts
Re: How to set charset in IIS7.0?
Feb 23, 2009 04:18 PM|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
and lines to the existing one.)