« Previous Next »

Thread: How to set charset in IIS7.0?

Last post 02-23-2009 12:18 PM by peaceable_whale. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 02-20-2009, 9:08 AM

    How to set charset in IIS7.0?

    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

     

     

     

  • 02-20-2009, 10:40 AM In reply to

    Re: How to set charset in IIS7.0?

    Hello,

    Should be "text/html;", not "image/jpeg;".

    Regards

  • 02-23-2009, 2:15 AM In reply to

    Re: How to set charset in IIS7.0?

    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.

  • 02-23-2009, 12:18 PM In reply to

    Re: How to set charset in IIS7.0?

    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 and mimeMap lines to the existing one.)

    <?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>
    Franklin Tse (whale)
Page 1 of 1 (4 items)
Microsoft Communities