Search code examples
character-encodingasp.net-mvc-5windows-server-2012iis-8

Windows 2012 Server character encoding issue


We have 2 staging servers both running Windows Server 2012. We have an MVC 5 website which has a page with an iframe. The source of the iframe is another action on the site. This action uses WebClient.GetAsync to make a request to another external website and return this contents in the iFrame.

The issue that we're seeing is that on developer machines and system test servers we're not seeing any issues. But on one of the 2 staging servers the characters output are totally incorrect. We get what looks like repeated sequences and un-displayable characters i.e �

What is confusing is that it's only occurring on one of the 2 servers in staging. We've looked at iis config, machine.config, web.config and can't see anything different.

The external website does return a response with a chinese charset specified.

<meta http-equiv="Content-Type" content="text/html;" charset="gb2312">

and the 1 staging server doesn't seem to handle it in the same way as the others.

Has anyone got any ideas what could be causing this?


Solution

  • This issue was being caused by New Relic. Both the external site and our site were using New Relic which was injecting into the page. This seemed to be causing an issue with page encoding.

    Adding the <requestPathsExcluded> element within <browserMonitoring> of the newrelic.config file solved our issue.

    Not exactly sure why it caused an issue though.