ResponseEncoding in IIS7 for static html files in web.config

I couldn’t find any way to set ResponseEncoding in IIS7 for static html files in web.config.

The system.web setting using globalization doesn’t seem to fit anywhere in system.webServer like it seems like it should (someone please let me know if there is a way to do that).

Anyway, I did find a way to sort of shove it in there:

<configuration>
  <system .web>
    <!-- not applied to HTML files -->
    <globalization requestEncoding="utf-8"
       responseEncoding="utf-8" />
  </system>
  <system .webServer>
    <staticcontent>
      <!-- This does get applied to HTML files -->
      <mimemap fileExtension="html"
         mimeType="text/html; charset=utf-8" />
    </staticcontent>
  </system>
</configuration>

Author: Kevin Newman

I’m the lead developer at adcSTUDIO located in Kingston NY (in Livingston Manor NY before that). I do all kinds of things there, from robust server side work to the much more enjoyable client side development in HTML/JavaScript/Flash (RIAs, HTML5, etc.) and all the other tech-buzz-phrases of the moment.

My brother came up with the idea for unFocus.com which was originally meant be a place to discuss and blog about whatever topics we both found interesting, from politics to technology, to art and design. Time was scarce, and I need a place to host History Keeper, and unFocus Projects – a sub focus of unfocus.com was born, and eventually migrated to the font page.

Oh, and I’m on Twitter (@Touvan) and Google+.

Leave a Reply

Your email address will not be published. Required fields are marked *