7

I try to force encoding with IIS 7.

When I add in the http response headers the key :

Content-Type and value charset=utf-8 i got this key content-type : text/html,content-type=utf-8

it's there a way to remove the comma ?

Thanks Justin for your answer.

But it's seen don't work. There is my config, i need to do that for asp classic.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <remove fileExtension=".html" />
            <remove fileExtension=".hxt" />
            <remove fileExtension=".htm" />
            <remove fileExtension=".asp" />
            <mimeMap fileExtension=".htm" mimeType="text/html" />
            <mimeMap fileExtension=".hxt" mimeType="text/html" />
            <mimeMap fileExtension=".html" mimeType="text/html" />
            <mimeMap fileExtension=".asp" mimeType="text/html; charset=UTF-8" />
        </staticContent>
    </system.webServer>
</configuration>
Cédric Boivin
  • 732
  • 4
  • 13
  • 31

1 Answers1

9

You can manually set the content type for specific file extensions in the web.config file for each web site where this is needed. In the root for the site, find the web.config file and add the remove and mimeMap lines as below (or create the entire file if it doesn't already exist).

<?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>

Sample taken from a discussion on the IIS Forums which addressed this question.

Justin Scott
  • 8,748
  • 1
  • 27
  • 39